Next post/previous post order
-
Newbie Kale user here, so sorry if I am missing something straight forward.
At the bottom of my posts, I have a next post/previous post link. However, they are not showing posts in chronological order (based on post date). It seems like they going to previous posts for each previous day of week (so Monday post goes to the prior Monday post, Wednesday to Wednesday, etc.).
Is there a setting that I am supposed to fix to put the previous/next posts in date order?
Thanks!
-
@thedragonsonfire, can we see a sample post to look into this further? There are no settings for this, and you can read more about it here: https://codex.wordpress.org/Next_and_Previous_Links#The_Next_and_Previous_Posts These links direct the user to move to the next or previous post in chronological order.
-
This reply was modified 8 years, 1 month ago by
lyrathemes.
This post is from March 28 and the prior post link is from March 21.
https://thedragonsonfire.com/destination-the-cancer-hospital/
However, there are posts from March 26 and March 23 that are not linked back to.
https://thedragonsonfire.com/2018/03/Thanks for looking into it!
@thedragonsonfire Ah I see now. It moves to the next/prev posts from within the same category. Would you like to change that behavior?
Ahh that seems to make sense. Yes, I would like the option to have it move forward and backward chronologically.
@thedragonsonfire This would require changing a line in one of the theme files, and we recommend creating a child theme for that purpose.
https://gist.github.com/lyrathemes/7f5c791b7351b7cadd7ab9faaba0b204
https://codex.wordpress.org/Child_ThemesOk thank you. So is the default in Kale to move forward and backward by category, not date? Just trying to understand what I might have done to make that the way the navigation works.
Yes, that is how we chose to use the links in Kale. There is an option to change it so it is not tied to the category but it needs to be changed in single.php (in the theme file that controls the post view).
Thanks for all the information. Is there simple coding to change the single.php so that post order is not tied to category (and is just done chronological)?
Hello @thedragonsonfire,
I imagine you are talking about the bottom pagination links, am I right? If so, then you can do the following.
Replace this lines of code:
<div class="previous_post"><?php previous_post_link('%link','%title',true); ?></div> <div class="next_post"><?php next_post_link('%link','%title',true); ?></div>with this ones:
<div class="previous_post"><?php previous_post_link('%link','%title',false); ?></div> <div class="next_post"><?php next_post_link('%link','%title',false); ?></div>That should include all the posts in chronological order for navigating.
Remember that you should do this inside a child theme (https://codex.wordpress.org/Child_Themes) so you don’t loose your changes on future updates.
Please, let me know if you need any further assistance.
Kind regards,
Diego -
This reply was modified 8 years, 1 month ago by
The topic ‘Next post/previous post order’ is closed to new replies.
