Tagged: arrow, navigation, post nav
-
AuthorPosts
-
October 14, 2021 at 12:12 pm #1324907
Hey,
I customized the navigation arrows so it stays in the same category and the arrows are flipped.
Next entry in the same category is on the right side and vice verca.// Posts in the same category add_filter("avia_post_nav_settings","avia_same_category_filter", 10, 1); function avia_same_category_filter($settings) { $settings["same_category"] = true; return $settings; } // Switched "Previous" und "Next" entries. next post -> right side, prev post -> left side add_filter('avia_post_nav_entries', 'avia_apply_custom_sort_order_to_post_nav', 10, 2); function avia_apply_custom_sort_order_to_post_nav($entries, $settings) { if(!empty($entries['prev'])) $temp = $entries['prev']; if(!empty($entries['next'])) $entries['prev'] = $entries['next']; if(!empty($temp)) $entries['next'] = $temp; return $entries; }
Now on the last or first entry of a post, both arrows display the same content.
I can’t figure out a way to disable the left arrow on the first post and right arrow on last post in the same category.
Can this be solved?
Thanks in advance!
October 18, 2021 at 8:13 am #1325359Hey emilconsor,
Thank you for the inquiry.
We adjusted the filter a bit to ensure that both arrows always contain different posts and hide the arrow that is empty.
// Posts in the same category function avia_same_category_filter($settings) { $settings["same_category"] = true; return $settings; } add_filter("avia_post_nav_settings","avia_same_category_filter", 10, 1); // Switched "Previous" und "Next" entries. next post -> right side, prev post -> left side function avia_apply_custom_sort_order_to_post_nav($entries, $settings, $queried_entries) { $entries['prev'] = $queried_entries['next']; $entries['next'] = $queried_entries['prev']; return $entries; } add_filter('avia_post_nav_entries', 'avia_apply_custom_sort_order_to_post_nav', 10, 3);
Best regards,
IsmaelOctober 19, 2021 at 9:28 am #1325532Hey Ismael,
thank you! That worked perfectly.
Appreciate your effort.
October 19, 2021 at 11:37 am #1325553Hi,
Glad Ismael could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Disable post nav arrow on first or last entry in a category’ is closed to new replies.