Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #204468

    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é

    #204486

    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

    #204499

    Thanks Dude, works just perfect!!

    Regards
    José

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘'You might also like' Customization’ is closed to new replies.