-
Posted in : TheBlogger
-
Hello,
I’ve been reading all the help you’ve provided related to “Related Posts”, but I couldn’t solve my problem yet :(The related posts section is showing only the same 5 or 6 latest posts, and it isn’t very useful. I’ve been trying a feel plugins (included YARPP), and they substitute your beautiful layout for this section or don’t have any effect.
I’d like to have my blog’s related posts showing up post based on tags, and I found a little code with the variables that I’d like to be considered in this section. Could you help me to make the piece of code bellow to work with the theme? Thanks!
<?php $orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
‘tag__in’ => $tag_ids,
‘post__not_in’ => array($post->ID),
‘posts_per_page’=>5, // Number of related posts that will be shown.
‘caller_get_posts’=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() ) {
echo ‘<div id=”relatedposts”><h3>Related Posts</h3>- ‘;
- <div class=”relatedthumb”>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_post_thumbnail(); ?></div>
<div class=”relatedcontent”>
<h3>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></h3>
<?php the_time(‘M j, Y’) ?>
</div>
while( $my_query->have_posts() ) {
$my_query->the_post(); ?><? }
echo ‘</div>’;
}
}
$post = $orig_post;
wp_reset_query(); ?>Hi, we will improve the “Related Posts” functionality with the next update. Thanks for the feedback.
Thanks for your answer, Mehmet. There’s any prevision of when the next update will be released?
Hi, We are working very hard right now and it may take a few weeks for the new update to arrive. You will be notified of the update released.
Thanks for your patience.Hi, we have just released a new update with the fix, you can download and update your theme now.
- <div class=”relatedthumb”>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_post_thumbnail(); ?></div>
You must be logged in and have valid license to reply to this topic.