Recent Posts
None | 12 sec ago
JavaScript | 12 sec ago
XML | 1 min ago
Bash | 1 min ago
XML | 2 min ago
None | 2 min ago
C | 2 min ago
None | 2 min ago
Lua | 2 min ago
PAWN | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By kuld33p on the 4th of Jul 2009 09:32:59 PM
Download |
Raw |
Embed |
Report
<div class="entry page">
<h2>Related Posts</h2>
<?php
//for use in the loop, list 5 post titles related to first tag on current post
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$first_tag = $tags[0]->term_id;
$args=array(
'tag__in' => array($first_tag),
'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(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
}
}
?>
</div>
Submit a correction or amendment below.
Make A New Post