-
AuthorPosts
-
June 27, 2018 at 12:35 pm #978382
Hi
I’m a bit confused by the next/previous order on the portfolio and masonary grid. For example, if you look at the Enfold Dark Photography demo homepage masonary grid. if you click on the first image, Belgium, there is no next arrow – it is the previous arrow that takes you to second image in the grid, Java. I can’t see how to make it the other way, i.e. so that the next buttons go in the same way as the grid order.many thanks
Peter
June 29, 2018 at 1:02 pm #979334Hey envapk2,
Thank you for using Enfold.
I didn’t check but the sort or orderby parameter of the demo’s portfolio/masonry is probably set to something else instead of “date”. You can use one of these filters to reverse the entries of the post navigation.
// https://kriesi.at/support/topic/how-to-display-avia-post-nav-with-same-category-only/#post-947205
// https://kriesi.at/support/topic/sequence-order-masonry-portfolio-grid/#post-920191Best regards,
IsmaelJuly 2, 2018 at 11:57 pm #980328Hi Ismael
Thanks for that, I’ve had a look through that and this is where I am now.
To reverse the direction of the next/prev buttons this works:
add_filter( ‘avia_post_nav_entries’, ‘enfold_customization_postnav’, 10, 2);
function enfold_customization_postnav($entries, $settings) {
$entries[‘prev’] = get_next_post($settings[‘same_category’]);
$entries[‘next’] = get_previous_post($settings[‘same_category’]);
return $entries;
}
However, I also want to restrict the next/prev to only showing one portfolio category. To do that this works:add_filter(‘avia_post_nav_settings’, ‘avia_post_nav_settings_mod’);
function avia_post_nav_settings_mod($settings)
{
if(is_singular(‘portfolio’)) {
$settings[‘taxonomy’] = ‘portfolio_entries’;
$settings[‘is_fullwidth’] = false;
}
$settings[‘same_category’] = true;
return $settings;
}But if I use both these together the next/prev buttons disappear completely.
many thanks
Peter
July 3, 2018 at 6:43 am #980401Hi,
Thanks for the update.
Remove the “avia_post_nav_settings” and then set the parameters directly on the entries filter.
add_filter( 'avia_post_nav_entries', 'avia_post_nav_entries_mod', 10, 2); function avia_post_nav_entries_mod($entries, $settings) { if(is_singular('portfolio'))) { $entries['prev'] = get_next_post(true, '', 'portfolio_entries'); $entries['next'] = get_previous_post(true, '', 'portfolio_entries'); } return $entries; }
Best regards,
IsmaelJuly 3, 2018 at 11:24 am #980498Hi Ismael
That works perfectly. There was a typo – extra ) – on line three, ie should be
if(is_singular(‘portfolio’))but it works fine now. Many thanks for the great support as usual.
Peter
July 4, 2018 at 2:26 am #980846Hi,
Awesome! Glad we could help!
Please take a moment to review our theme and show your support https://themeforest.net/downloads
Don’t forget to bookmark Enfold Documentation for future reference.Thank you for using Enfold :)
Best regards,
Ismael -
AuthorPosts
- The topic ‘Portfolio/Masonary grid next/previous order’ is closed to new replies.