如何在下面的query\\u帖子中检查两个category\\u name值?
<?php query_posts(\'category_name=recent-work&posts_per_page=1\');
if (have_posts()) : while (have_posts()) : the_post(); ?>
所以它读起来像这样: <?php query_posts(\'category_name=recent-work&&category_name=plumbing&posts_per_page=1\');
if (have_posts()) : while (have_posts()) : the_post(); ?>
非常感谢。EDIT:
<?php
$querySimilarWork = new WP_Query( array(
\'tax_query\' => array(
array(
\'taxonomy\' => \'categories\',
\'field\' => \'slug\',
\'terms\' => array( \'recent-work\', \'plumbing\' )
)
),
\'posts_per_page\' => 4
);
?>
EDIT:如果我现在查询这个WP\\u查询,它不会返回任何内容?
<?php while ($querySimilarWork->have_posts()) : $querySimilarWork->the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>