• I would like to make a custom query that checks to see if a post is in two categories. Something like: A ‘and’ B…

    What is the query_posts() syntax for this? You can see my attempt below which does not work. I’m using this to separate news articles from different years.

    <?php if (is_page('84')) { ?>
    			<?php query_posts('category_name=inthenews&showposts=10'); ?>
    
    		<?php } elseif (is_page('90')) { ?>
    		<?php query_posts('category_name=inthenews && category_name=2007'); ?>
    
    		<?php } elseif (is_page('91')) { ?>
    		<?php query_posts('category_name=inthenews && category_name=2006'); ?>
    
    		<?php } elseif (is_page('92')) { ?>
    		<?php query_posts('category_name=inthenews && category_name=2005'); ?>
    
    		<?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Trouble with query_posts( )’ is closed to new replies.