multiple loops with if statement syntax question
-
I multiple loops running on one page. The loop I need help with is this:
<?php $my_query = new WP_Query(‘category_name=client-list&showposts=1’); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>It works fine. What i want to do, is say “if on specific page, then do a new query for a specific category name. So it’s basically amalgamating the above code with this code:
<?php
if (is_home()) {
do the above loop;
}
?>And then to make it better, I want to have multiple if statements (for 5 different pages that will show a specific category loop). E.g if on “clients” page, make a new query for the category “people”, if on “home” page make a new query for “news” category. I’m using new query, because there is already a loop for the page content.
Anyone good at syntax that can put this together?
Thanks!!
- The topic ‘multiple loops with if statement syntax question’ is closed to new replies.