Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Excerpts, Read more, Pagination (http://forum.bytesforall.com/forumdisplay.php?f=20)
-   -   Next/Previous navigation question (http://forum.bytesforall.com/showthread.php?t=4225)

lmilesw Nov 5, 2009 09:18 AM

Next/Previous navigation question
 
I'm using the standard categories widget. When I click on the category it of course takes me to a listing of posts in that cat. When I click on the title to open the post the next/previous links at the top aren't limited to the particular category I chose. Is there a way to constrain the next/previous to the category I selected?

juggledad Nov 5, 2009 12:09 PM

The theme is using the standard WordPress nav code (wp-inlcudes/link-template.php)

What this measn is that when you finally get to a single POST page, Wordpress uses teh next/previous POSTS in the database, it's not keeping track of the category.

You might be able to hack the link-template.php code and change how it is getting the next and previous links

Nickp Nov 6, 2009 04:26 AM

I wanted to implement a Next\Previous In Category link to replace the default Next/Previous links on my single post pages. Rather than change the wp function, I made the following changes in the theme:

In the bfa_next_previous_links.php code:
Find this function:
Code:

function bfa_next_previous_post_links($location = "Top")
Then in the two places where this code appears:
Code:

previous_post_link($bfa_ata['single_next_prev_older']) :
next_post_link($bfa_ata['single_next_prev_newer']);

Replace it with this code:
Code:

previous_post_link($bfa_ata['single_next_prev_older'],'%title',true) :
next_post_link($bfa_ata['single_next_prev_newer'],'%title',true);

The 'true' argument is the one that wp interprets to limit the navigation to the "current" category.

This seems to work ok in a blog where each post is associated with only one category. I haven't tested the behaviour where each post exists in multiple categories. I would hope there would be some persistence of category (but I'm not going to rely on it).

Nor have I thought too hard yet about pagination of posts so we're definitely into quick fix territory with this one!!

Can anyone see any problems with this approach?

mjrouleau Jan 8, 2010 02:52 PM

This plugin works beautifully, even with posts belonging to more than one category:
http://wordpress.org/extend/plugins/smarter-navigation/

Somehow the plugin detects from wich category page the user comes from.

I'm using ATA 3.4.4 and WP 2.8.6

Hope this helps!
M-J

victorm Feb 3, 2010 02:24 PM

nickp, I'd like to try that - my coder will look at it. we have this issue with posts which are totally unrelated to other categories than their own (keep Google from thinking we are interlinking anything is important for authority). my only concern is with Flynn's next version - you need to fork and track these changes yourself, which I don't like too much.

rottwlrmom Apr 9, 2010 11:05 PM

I tried it and LOVED it! So easy to use!


All times are GMT -6. The time now is 03:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.