【发布时间】:2014-11-18 20:51:57
【问题描述】:
我正在尝试在一页(6 和 7)上显示来自两个类别的帖子。它应该包括来自任何一个类别的帖子以及与这两者都匹配的帖子。不幸的是,到目前为止,我只找到了后者的解决方案,这就是我现在向您寻求帮助的原因。这是我当前的代码:
<div class="sponsoren_container_wrapper">
<?php $args = array ( 'posts_per_page' => -1, 'category' => 6 );
$myposts = get_posts ( $args );
foreach ($myposts as $post) : setup_postdata( $post ); ?>
<div class="gallery_image_container">
<a href="<?php
$content = get_the_content();
print $content;
?>" title="<?php the_title_attribute(); ?>">
<div class="gallery_image_thumb">
<?php the_post_thumbnail('thumbnail'); ?>
</div>
<div class="gallery_title">
<h2>
<?php the_title(); ?>
</h2>
</div>
</a>
</div>
<?php endforeach; wp_reset_postdata(); ?>
</div>
我将如何将类别 ID“7”添加到该代码以使一切正常,如上所述? 提前致谢!
【问题讨论】: