Next and Previous links restricted to 2 categories (1 post)

  1. admiralnovia
    Posted 10 years ago #

    Hi. I've checked the archives, and couldn't find quite exactly what I need.

    I have a client who has asked for "next" and "previous" links on single-post pages with a number of restrictions. Basically, he has multiple categories like this:

    * Doors
    * Floors

    * Featured
    * Not Featured

    When looking at, for instance, a "Doors" posting, he would like the prev and next links to point to the next "Doors" posting by date, and that IS ALSO in the "Featured" category. In other words, he wants the next and prev links to click-through all postings that are in both the "Doors" category and the "Featured" category.

    At first, I thought I could use the excluded_categories parameter of next_post_link and previous_post_link to do this, ie: to exclude the postings that are "Not Featured", but it turns out that excluded_categories doesn't actually work in WP 1.5.

    I assume I need a custom MySQL query to give my client want he wants here, but I'm not an expert at MySQL, so I was hoping for an easier solution.

    Any thoughts? Thank you in advance for your time.

Topic Closed

This topic has been closed to new replies.

About this Topic