Есть куча способов вівести похожие посты, но все они базируются на взятом перевом теге. Вот наконец нашел решение по нескольким тегам:
<div id="content-main">
<?php
// List posts by the terms for a custom taxonomy of any post type
$post_type = 'YOUR_POST_TYPE';
$tax = 'YOUR_TAXONOMY';
$tax_terms = get_terms( $tax );
if ($tax_terms) {
foreach ($tax_terms as $tax_term) {
$args = array(
'post_type' => $post_type,
"$tax" => $tax_term->slug,
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) : ?>
<h2 class="breadcrumb">All <?php echo $tax; ?> Posts For <?php echo $tax_term->name; ?></h2>
<ul class="taxlist">
<?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; // end of loop ?>
</ul>
<?php else : ?>
<?php endif; // if have_posts()
wp_reset_query();
} // end foreach #tax_terms
}
?>
</div>
Но этот разбивает посты на блоки по каждому тегу. А как вывыести все вместе, и чтобы при этом посты не повторялись. Такое возможно?