Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php global $post;
- $nextTagThumb='-1';
- $yourCategory = '4';
- $tags = wp_get_post_tags($post->ID);
- foreach ($tags as $tag) :?>
- <?php
- if ($tags) {
- $what_tag = $tags[($nextTagThumb+'1')]->term_id;
- $args=array(
- 'category__in' => array($yourCategory),
- 'tag__in' => array($what_tag),
- 'post__not_in' => array($post->ID, $do_not_duplicate),
- 'showposts'=>20,
- 'caller_get_posts'=>1
- );
- $my_query = new WP_Query($args); $do_not_duplicate = array();
- if( $my_query->have_posts() ) {
- while ($my_query->have_posts()) : $my_query->the_post(); if (!in_array($post->ID, $do_not_duplicate)) ?>
- <li class="post-<?php the_ID(); ?>">
- <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><span class="sidebar-post-title"><?php the_title(); ?></span>
- <span class="sidebar-post-thumb"><img src="<?php echo get_post_meta($post->ID, "sidebar-thumb", true);?>" /></span>
- </a>
- </li>
- <?php endwhile;
- }
- wp_reset_query();
- $nextTagThumb = ($nextTagThumb+1);
- }
- ?>
- <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement