Filtering ‘Featured’ posts in a category page
-
I am trying to create customized category pages. At the top of each page, I’d like to have two posts which basically are featured posts. Currently on the home page, I have a condition where posts from the ‘Featured’ category show up. However I am trying to create a conditional statement that factors in both when viewing category pages.
So for instance, I have Travel section which has a few child categories as well. I’d like to now pull posts from the Travel category and respective child categories, which are also filed under Featured.
This is a sample of my code I use for the index at the moment.
<?php $my_query1 = new WP_Query('showposts=2&category_name=featured'); ?> <?php while ($my_query1->have_posts()) : $my_query1->the_post(); ?> [post styling here] <?php endwhile;?>
Is it possible to start off with something like category_name=travel+hotels+reviews and then have some kind of sub-query to filter out the posts from those categories that also are filed under “Featured”?
- The topic ‘Filtering ‘Featured’ posts in a category page’ is closed to new replies.