I found other post on this topic but it did not help me. If I add this code to my code, is it possible to display related posts from same category as the current post?
I'm posting the code below to show what I'm trying to achieve:
<?php
$related = get_posts( array( 'category__in' =>
wp_get_post_categories($post->ID), 'numberposts' => 5, 'post__not_in' => array($post->ID) ) );
if( $related )
foreach( $related as $post ) {
setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php }
wp_reset_postdata(); ?>
Display related posts from the same category