Apply custom sorting for Next / Previous site-wide navigation

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’

1add_filter('apto/navigation_sort_apply', 'theme_apto_navigation_sort_apply');
2function theme_apto_navigation_sort_apply($current)
3    {
4        global $post;
5         
6        if($post->post_type == 'post')
7            $current    =   TRUE;
8            else
9            $current    =   FALSE;
10         
11        return $current;  
12    }

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

*This replaced the old cpto/navigation_sort_apply