
Untitled
By:
hattendesign on
May 22nd, 2012 | syntax:
None | size: 0.74 KB | hits: 36 | expires: Never
<?
$backup = $post;
$tags = wp_get_post_tags($post->ID);
$tagIDs = array();
if ($tags) {
$tagcount = count($tags);
for ($i = 0; $i < $tagcount; $i++)
{
$tagIDs[$i] = $tags[$i]->term_id;
}
$args=array( 'tag__in' => $tagIDs,'post__not_in' => array($post->ID), 'showposts'=>5, 'caller_get_posts'=>1);
$my_query = new WP_Query($args);
if( $my_query->have_posts() )
{
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<? endwhile;
}
}
else { ?>
<h2>No related trailers found!</h2>
<?php }
$post = $backup;
wp_reset_query();
?>