title: How to display post category inside page.php if else statement?
body: <p>I have set up a few categories and want to display specific ones based on <code>is_page()</code>. </p>
  
  <p>Inside <code>page.php</code>, I've created an <code>if..else</code> statement that checks the page name and prints out the specific category. My problem at the moment is that instead of just <code>the_title</code> being printed out the whole post is being printed. </p>
  
  <p>Where am I going wrong with this?</p>
  
  <pre><code>&lt;?php while ( have_posts() ) : the_post(); ?&gt;
  &lt;?php get_template_part( 'content', 'page' ); ?&gt;
  &lt;?php if ( is_page( 'Greywater Recycling' ) ) { ?&gt;
  &lt;div class="col"&gt;
      &lt;?php query_posts( 'category_name=Greywater Recycling&amp;posts_per_page=5'); if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
       &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
  
      &lt;?php endwhile; endif; ?&gt;
  &lt;/div&gt;
  &lt;?php } else if ( is_page( 'Stormwater Management' ) ) { ?&gt;
  &lt;div class="col"&gt;
      &lt;?php query_posts( 'category_name=Stormwater Management&amp;posts_per_page=5'); if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
       &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
  
      &lt;?php endwhile; endif; ?&gt;
  &lt;/div&gt;
  &lt;?php } else if ( is_page( 'Rainwater Harvesting' ) ) { ?&gt;
  &lt;div class="col"&gt;
      &lt;?php query_posts( 'category_name=Rainwater Harvesting&amp;posts_per_page=5'); if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
       &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
  
      &lt;?php endwhile; endif; ?&gt;
  &lt;/div&gt;
  &lt;?php } ?&gt;
  &lt;?php endwhile; // end of the loop. ?&gt;
  </code></pre>