Hi I want to achieve something very spoecific. I should say that I have tried the plugins listed on this site, but haven't found anyone/or I have not been god enough to modify it so that it would do this.
Under each post in my single.php I would like to show 2 random posts from the tags associated with the post, together with an image from a custom field plus the Excerpt.
So under each post, I would like to get two random posts from the tags returned by:
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ' ';
}
}
?>
And show them like this:
<div class="related_posts">
<h2>Related posts</h2>
<div class="first_related"> <a href="<?php the_permalink(); ?>"><img src="customfield_image" /></a>
<p><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a></p>
<p>
<?php the_excerpt(); ?>
</p>
</div>
<div class="second_related"> <a href="<?php the_permalink(); ?>"><img src="customfield_image" /></a>
<p><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a></p>
<p>
<?php the_excerpt(); ?>
</p>
</div>
</div>
I have also tried to have a look at the "Custom Post Listing" plugin but I couldn't see if it would be able to do this.
Hopefully someone can give me some leads to follow.