Filter – Apply sort for default next_post_link() and previous_post_link()

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPrint this page


A sort will apply to all next / previous side-wide navigation links if the Next / Previous Apply option is turned on. In case this need to apply only when certain conditions are fulfilled .
The follogin filter can be used ‘apto/navigation_sort_apply’

     add_filter('apto/navigation_sort_apply', 'theme_apto_navigation_sort_apply');
    function theme_apto_navigation_sort_apply($current)
        {
            global $post;
            
            if($post->post_type == 'post')
                $current    =   TRUE;
                else
                $current    =   FALSE;
            
            return $current;   
        }

The above will makes the code to apply the customized sort on navigation links only if post type is a Post.

API Index