Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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.

    Example Site

    Can this be solved?

    Thanks in advance!

    #1325359

    Hey 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,
    Ismael

    #1325532

    Hey Ismael,

    thank you! That worked perfectly.

    Appreciate your effort.

    #1325553

    Hi,
    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Disable post nav arrow on first or last entry in a category’ is closed to new replies.