Adding if statement into the_content()

I don’t know exactly how your code works BUT I do know this. If you only have one loop on the page-template you could use query_posts(); but if you have more than 1 loop it will screw up the code, even if you reset it. I would recommend you to use WP_Query like this:

<?php
// The Query
$the_query = new WP_Query('category_name=vacancies');
if($the_query) echo '<ul>';
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
?>

<li><a href="https://wordpress.stackexchange.com/questions/36863/<?php the_permalink() ?>"><?php the_title(); ?></a></li>

<?php       
endwhile;
if($the_query) echo '</ul>';
// Reset Post Data
wp_reset_postdata();
?>

WP_Query