I'm trying to use the Smarter Navigation plugin to work so that when I click on an individual post from the category page, the single post navigation only goes to the next post in the same category. I am using the plugin because the default WP navigation doesn't take into account the referring link when a post has multiple categories.
This is the code for the link to the previous post in
<?php $prev_post = get_previous_post(TRUE,'all','category'); if(!empty($prev_post)): echo 'not empty'; previous_post_smart(); else: echo 'empty'; endif; ?>
This is what is happening, taking into account these posts and category arrangements
Category-ALL: 4th-post, 3rd-post, 2nd-post, 1st-post,
Category-IMAGE: 4th-post, 2nd-post
Category-VIDEO: 3rd-post, 1st-post
With the above code in the
single.php template for the 2nd-post, if I click on the link for the 2nd-post from the Category-IMAGE page, it will echo
not empty but the
previous_post_smart() function will return nothing because there is no previous post in the IMAGE category.
If I understand correctly
get_previous_post(TRUE,'all','category') is saying, "get the previous post in the same category excluding the category all, but I think what is happening is that it is including the category all.
I say this because the same is true for the reverse; for the 3rd-post, referred from the Category-VIDEO page, with the
get_next_post() function with the same parameters it also returns