Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #185699

    Is there a way to make the “related portfolio posts” slider choose related posts but from a different category? How do I let it know which category to choose from?

    Thanks

    #186140

    Hey InterdisciplinaryInnovation!

    You can choose multiple categories by holding CTRL button on Windows ( could be Command button on MAC, not sure :) ) in post slider http://i.imgur.com/dHvBuYL.jpg

    Cheers!
    Yigit

    #186209

    Hi Yigit,

    I think that you misunderstood my question. I did not ask how to add more categories to a “PORTFOLIO SLIDER”. My question is about the “RELATED ENTRIES SLIDER.” on a SINGLE PORTFOLIO PAGE. The way Kresi coded it, the them will search for “RELATED POSTS” according to the category that SINGLE PORTFOLIO PAGE is associated with. I want all of the thumbnails in the RELATED POSTS section of the SINGLE PORTFOLIO PAGE to choose from the SAME CATEGORY (that I hard code in), not the category associated with that particular portfolio entry.

    So my question is: “In the “related portfolio posts” php file, what change do I make to it so that I tell it to select post from for instance, from the “News” category, instead of the category that happens to be associated with the single portfolio?

    #186411

    Hi!

    Open up wp-content\themes\angular\includes\related-portfolio-posts.php and replace

    
    $tags = wp_get_object_terms( $post->ID, 'portfolio_entries');
    
    if ($tags) {
     
         $tag_ids = "";
         foreach ($tags as $tag ) $tag_ids .= $tag->slug.",";
         
         $tag_ids = substr_replace($tag_ids ,"",-1);
         $tag_ids = str_replace(" ", "-",$tag_ids);
    	
         if($tag_ids) 
         {
         	$my_query = new WP_Query(array('portfolio_entries'=>$tag_ids, 'showposts'=>$postcount, 'ignore_sticky_posts'=>1, 'orderby'=>'rand', 'post__not_in' => array( $this_id ) ) );
    

    with

    
    $tag_ids = array(10);
    
    if ($tag_ids) {
         if($tag_ids) 
         {
         	$my_query = new WP_Query(array('category__in'=>$tag_ids, 'showposts'=>$postcount, 'ignore_sticky_posts'=>1, 'orderby'=>'rand', 'post__not_in' => array( $this_id ) ) );
    

    and instead of 10 insert the id of your category.

    Regards,
    Peter

    #186502

    Thank you Peter and Yigit for your help!

    I used the following plugin to find my category id, and made the changes you suggested.

    I really appreciate the help, I have learned so much from all of the members of the support team.

    Thanks again!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Make the Related Posts Slider Choose Portfolio Items from a Different Category’ is closed to new replies.