
How do I display related posts based on categories instead of tags?
Open buddy/lib/admin/inc/shortcodes/related-posts.php and find:
$tags = wp_get_post_tags($id); $tempQuery = $wp_query; if($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( 'post_type' => explode(',', $content), 'post_status' => 'publish', 'cat' => $cats, 'paged' => 1, 'ignore_sticky_posts' => 0, 'orderby' => $orderby, 'order' => $order, 'posts_per_page' => $per_page, 'offset' => $offset, 'tag__in' => $tag_ids, 'post__not_in' => array($id) );
Replace with:
$tags = get_the_category($id); $tempQuery = $wp_query; if($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( 'post_type' => explode(',', $content), 'post_status' => 'publish', 'cat' => $cats, 'paged' => 1, 'ignore_sticky_posts' => 0, 'orderby' => $orderby, 'order' => $order, 'posts_per_page' => $per_page, 'offset' => $offset, 'category__in' => $tag_ids, 'post__not_in' => array($id) );