Advertisement
hattendesign

Untitled

May 22nd, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?
  2. $backup = $post;
  3. $tags = wp_get_post_tags($post->ID);
  4. $tagIDs = array();
  5. if ($tags) {
  6. $tagcount = count($tags);
  7. for ($i = 0; $i < $tagcount; $i++)
  8. {
  9. $tagIDs[$i] = $tags[$i]->term_id;
  10. }
  11.  
  12. $args=array( 'tag__in' => $tagIDs,'post__not_in' => array($post->ID), 'showposts'=>5, 'caller_get_posts'=>1);
  13. $my_query = new WP_Query($args);
  14. if( $my_query->have_posts() )
  15. {
  16. while ($my_query->have_posts()) : $my_query->the_post(); ?>
  17. <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
  18. <? endwhile;
  19. }
  20. }
  21. else { ?>
  22. <h2>No related trailers found!</h2>
  23. <?php }
  24.  
  25. $post = $backup;
  26. wp_reset_query();
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement