Hi!!
I would like to have ‘You might also like’ restricted only to the categories that current post have, is it possible to set it up?
Thanks a lot and a good 2014 year!!
Regards
José
Hey jmaguirrei!
Try to replace following code in /wp-content/themes/enfold/includes/related-posts.php
$my_query = get_posts(
array(
'tag__in' => $tag_ids,
'post_type' => get_post_type($this_id),
'showposts'=>$postcount, 'ignore_sticky_posts'=>1,
'orderby'=>'rand',
'post__not_in' => array($this_id))
);
with
$cat_ids = array();
$categories = get_the_category($this_id);
if($categories)
{
foreach($categories as $category)
{
$cat_ids[] = $category->term_id;
}
}
$my_query = get_posts(
array(
'tag__in' => $tag_ids,
'category__in' => $cat_ids,
'post_type' => get_post_type($this_id),
'showposts'=>$postcount, 'ignore_sticky_posts'=>1,
'orderby'=>'rand',
'post__not_in' => array($this_id))
);
Regards,
Peter
Thanks Dude, works just perfect!!
Regards
José