Join category and tag
-
Hello, I am using this to list posts in a given category.
<?php $cats = get_categories('include=11'); foreach ($cats as $cat) { echo "<ul>"; $custom_loop = new WP_Query('posts_per_page=-1&cat=' . $cat->cat_ID); while ($custom_loop->have_posts()) { $custom_loop->the_post(); $category = get_the_category(); // Only display a post link once, even if it's in multiple categories if ($category[0]->cat_ID == $cat->cat_ID) { echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>'; } } echo "</ul>"; } wp_reset_query();
How can I add a tag to this?
I’d like to list posts in a given category that also have a given tag.
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Join category and tag’ is closed to new replies.