Добрый всем день, имеется стандартный код вывода похожих записей на странице Wordpress, который сортирует похожие статьи по тегам. Какую добавку в код нужно сделать, чтобы сортировка выполнялась по всем меткам, КРОМЕ одной, для определенностью кроме метки с ID=100? Код (PHP): <?php $orig_post = $post; global $post; $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach ($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args = array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => 5, // Number of related posts that will be shown. 'caller_get_posts' => 1 ); $my_query = new wp_query($args); if ($my_query->have_posts()) { echo '<div id="related_posts" class="clear"><h3>Другие интересные статьи:</h3><ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> [url="<?php the_permalink() ?>"]<?php the_title(); ?>[/url] <?php } else { ?> [url="<?php the_permalink() ?>"]<?php the_title(); ?>[/url] <?php } ?> </li> <?php } echo '</ul></div>'; } } $post = $orig_post; wp_reset_query(); ?>
попробуй так Код (PHP): $orig_post = $post; global $post; $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach ($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args = array( 'tag__in' => $tag_ids, 'tag__not_in' => array(100), 'post__not_in' => array($post->ID), 'posts_per_page' => 5, // Number of related posts that will be shown. 'caller_get_posts' => 1 ); $my_query = new wp_query($args); if ($my_query->have_posts()) { echo '<div id="related_posts" class="clear"><h3>Другие интересные статьи:</h3><ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> [url="<?php the_permalink() ?>"]<?php the_title(); ?>[/url] <?php } else { ?> [url="<?php the_permalink() ?>"]<?php the_title(); ?>[/url] <?php } ?> </li> <?php } echo '</ul></div>'; } } $post = $orig_post; wp_reset_query(); ?>