-
AuthorPosts
-
October 4, 2015 at 4:02 pm #513337
Hi!
I made this beautiful website using the Enfold Theme. But I need help with a special request of my client.I made a list of portfolio items (projects). And these items are being presented on several different pages, in different order (linked projects), using the Masonry Gallery. Now when you open a portfolio item by clicking one of these images and than use the arrows to go to the previous/next portfolio item you automatically go to the previous/next portfolio item of the main list. But I only want to show the portfolio items that are included in that specific Masonry Gallery on that specific page. How can I fix this? Did I miss a special setting option for this? Hope you can help me out.
Kind regards,
CharlotteOctober 5, 2015 at 12:00 pm #513648Hi Boulanger!
Thank you for using Enfold.
Please add this in the functions.php file to set the “$same_category” option to true:
add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1); function avia_same_category_filter($settings) { $settings['same_category'] = true; return $settings; }
Remove browser cache then reload the page.
Best regards,
IsmaelOctober 9, 2015 at 1:43 pm #516443Hi Ismael,
I added the code but when I click on an portfolio item in the Masonry Gallery and try to move to the next item (in the same masonry gallery) using the arrows on the left/right side I still end up in a complete other portfolio item. Note: I use the Masonry Gallery, not the Portfolio Grid of Masonry.
Kind regards,
CharlotteOctober 14, 2015 at 6:28 am #518497Hi!
It works OK on our installation. Can you please provide the url to the portfolio item where this is not working? Note that if the post belongs to multiple categories, it will also display posts which belongs to other categories.
Best regards,
IsmaelOctober 17, 2015 at 9:14 pm #520474Hi Ismael,
Thanks for your reply. The thing is that all portfolio items belong to multiple categories. So that’s why it didn’t work for me. I really need to navigate through only one specific category at the time. Do you happen to have more tricks up your sleeve for this particular issue. Really hope you can help me out here.
Kind regards,
CharlotteOctober 18, 2015 at 5:40 am #520502Hi!
I’m not sure if this is going to work but try to replace the code in the functions.php file:
//same category add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1); function avia_same_category_filter($settings) { if(is_singular('portfolio')) { $id = avia_get_the_id(); $exclude = array(); $categories = get_the_terms($id, 'portfolio_entries'); foreach($categories as $category) { $exclude[] = $category->term_id; } $include = array_shift($exclude); $settings['same_category'] = true; $settings['excluded_terms'] = $exclude; } return $settings; }
This will exclude all categories except for the first category of the post.
EDIT: We modified the code a bit.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.