-I am trying to use 1 template (inner.php) for multiple Pages.
-I would like each page to pull in information from multiple posts.
-One thing I am including is ‘header image’ which is an image and caption.
-I am using wP_Query to grab & displays posts with certain categories or tags
I am wondering if I can use Conditional Statements within a query?
Or, is there something I can add to the code below to have the results be based on the post tag matching up with the Page ID or Title?
<div id="headerImage"> <?php $headerImage = new WP_Query(); $headerImage->query('category_name=headerImage&showposts=1'); while($headerImage->have_posts()) : $headerImage->the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>" style="background:white;"> <div class="entry"> <?php the_content(''); ?> </div> <?php endwhile; ?> </div>
Something like this…
- The topic ‘WP_Query & Conditional Statements OR how to pull in a post based on the page id’ is closed to new replies.