Only showing posts that is in both in categories X & Y
-
Hi
I am currently trying to work out the best way to only show posts which are in 2 specific categories, so post’s that are in category X and in category Y. I have currently done it by the below code but it isn’t an great solution since I will end up with less posts than what my limit is set at.
query_posts( 'posts_per_page=10&cat=10,15' ); while ( have_posts() ) : the_post(); if ( in_category(15) && in_category(10)) { ?><li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> <?php the_title(); ?></a></li><? } endwhile; wp_reset_query();
Anyone got any suggestions? or How would I manage it via a MySQL query?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Only showing posts that is in both in categories X & Y’ is closed to new replies.