Incorporating “category__in” into category.php
-
I have a site that is comprised of categories and sub-categories. I’d like to have only the category’s child posts display on the category.php page. I’m using the following to order posts, so I think there’s a way to add the category__in parameter, but I haven’t been able to figure out how.
<?php $cat_title = single_cat_title('', false); $cat_id = get_cat_ID($cat_title); $wp_query->set('orderby', 'category'); $wp_query->set('order', 'ASC'); $wp_query->get_posts(); get_posts('orderby=category&order=ASC'); ?> <?php if (have_posts()) : ?> etc.
$cat_id is to obtain the current category’s ID to use limiting to that category, but as I said, I can’t figure out how to do it. If there’s another approach to accomplish this, that would be fine, too.
Thanks.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Incorporating “category__in” into category.php’ is closed to new replies.