Shortcode for "link to next post in category."
-
What is the shortcode I can add to the bottom of a post that will give me a link to the next (chronologically) post in the same category? Ideally with the text including the name of that post? And similar code for previous post in the same category. Either with the next/previous arrows or saying something like “Next post in [Category]:[post title]”
Better still, does anyone know a plugin that will do the trick?
I’ve been trying to find a plugin that will let me set up a series of posts and have this navigation. I’ve searched plugins for “series” but any I’ve found that seem to give this setup have problems with layout or a tendency to muddle up the order or lose posts.
I can assign a category for a series of posts. So maybe there is a straightforward shortcode I can insert at the bottom of each post in the series as I write it that will do this.
Currently I’m using Really Simple Series because this makes the category page lists posts from oldest to newest, which reads better for this series. But it doesn’t have the next/previous control. It does put a list of the posts at the bottom of each but doesn’t show which is currently viewed so it still isn’t obvious to navigate. And unless I subdivide this series, that list is going to be way too long as there may be 50 or so posts in the journal.
If I haven’t been clear about what I want, here’s the reason behind and details of what I’m trying to achieve:
Website is https://www.hphl.org.uk and the series is the category Cherry’s Implant Blog. (Introduction is on the front page still.)
I have a guest blog on my site and because it’s an account of someone’s assessment, surgery and rehabilitation, the posts are best read in date order, oldest first. And I want people to be able to read the series, without other posts, posted during the same time interval, intervening.
I can give the posts a unique category. People could click on the category name for a list of posts but that will normally be in reverse date order so people would naturally click on the newest first. And would need to keep coming back to the category page to find the next. So that’s no good.
I’m using the theme Suffusion and have found the option that lets me put Next/Previous as the top of the posts, not way down below the comments box where I think most people wouldn’t see it. And I’ve found the option that sets Next/Previous to stay within categories. (Other graphical elements > Breadcrumbs and Page Navigation > Previous/Next Posts).
Which would be great for the series, but not for the rest of my posts. Because normally I’d like people to move through all my posts, reading posts from all categories. If I restrict to categories, they’ll only see a few posts (very few, it’s not a prolific site!). If I insert code to say “if this category, then do this behaviour” into wherever is the file that produces next/previous, then people not reading the series will get looped into the series when they reach one of its posts and miss the other content that’s in other categories.
Is there a way I can set this up? So the guest series has its own navigation? And there will probably be other series to come, so I’ll need to be able to have several series set up this way.
I’ve been trying to find a plugin and searched on “series.” I’ve tried out everything I can find and there seem problems with them all. Some look as though they’ll do the trick but the “next/previous” aren’t laid out properly or don’t always seem to work. Or the order gets muddled.
Sorry for the long post. Thanks for help.
- The topic ‘Shortcode for "link to next post in category."’ is closed to new replies.