query_posts question
-
On my site, I have three sections at the bottom, where I am using query_posts to pull in partial content of three Pages. After this section, I have a conditional set to show something if it’s only the index page – however, the conditional isn’t working.
It seems the reason is because of the three queries that appear prior. Is there something I’m missing?
<?php query_posts('page_id=8'); if (have_posts()) : ?> <div> <?php while (have_posts()) : the_post(); ?> <?php echo get_post_meta($post->ID, 'meta', TRUE); endwhile; ?> </div> <?php endif; ?> <?php query_posts('page_id=9'); if (have_posts()) : ?> <div> <?php while (have_posts()) : the_post(); ?> <?php echo get_post_meta($post->ID, 'meta', TRUE); endwhile; ?> </div> <?php endif; ?> <?php query_posts('page_id=10'); if (have_posts()) : ?> <div> <?php while (have_posts()) : the_post(); ?> <?php echo get_post_meta($post->ID, 'meta', TRUE); endwhile; ?> </div> <?php endif; ?> <?php if(is_home()) { get_sidebar(); } get_footer(); ?>Would anyone know why the conditional doesn’t work? If I remove the queries, or place the conditional *before* the queries, then it works just fine. But I need it to come after, and the conditional refuses to work as long as the queries are there (I’ve even tried placing the conditional in the sidebar – or in the footer – but it still doesn’t acknowledge it because of the queries).
Am I missing something? Any help would be appreciated.
The topic ‘query_posts question’ is closed to new replies.