• Hi, I’m working on a site that I want to work like this:

    Most of my posts are in only one of several categories. A few of my posts, however, are in two categories, a main one and a “special content” category. The way I would like this to work is that I want my “normal” posts to only show up in category archives pages, ie: they never get displayed by themselves as single/permalink pages. However, the ones that are also in the “special content” category will have a permalink link to their own single page.

    So far, so good. In the category templates, I know how to display a permalink link for those that have “special content”, and how to avoid displaying a permalink link for those that do not have “special content”.

    My problem is with using the next_post_link and previous_post_link commands on the single pages. I set the in_same_cat parameter to true, and it works, except that it links to the very next post even when it is not a “special content” posting.

    The next_post_link and previous_post_link commands also have an excluded_categories parameter, which would be great and would solve all my problems, but it doesn’t seem to work. If it did work, I could change my system to setting the “normal” posts to a category like “not special content”, and then exclude that category when calling next_post_link and previous_post_link, but nothing I do gets the parameter to do it’s thing.

    I also considered using child categories, where each main category would have a child category called “special content”, but that doesn’t work either. The next_post_link and previous_post_link commands always seem to grab the parent category, rather than just the specific child category the post belongs to.

    I tried looking this up in the Wiki, but there are no entries for next_post_link and previous_post_link. Appearently, these are replacements for older commands called next_post and previous_post, and on those Wiki pages, the excluded_categories parameter is called “archaic”.

    I found a plugin written by “scriptygoddess” that shows a multiple next and prev links for every category a post belongs to, but it gets the posts by ID, not by date; and I don’t want any links to any post that doesn’t contain “special content”.

    I’ve spend quite a bit of time trying to look for solutions to this on the Internet, but to no avail. Any thoughts? I really love WordPress, but the documentation on the Wiki always seems several months, (or sometimes even years), out of date.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘next_post_link and previous_post_link’ is closed to new replies.