• Hey Hey,

    I’ve been doing some research and haven’t come across a solid answer as of yet, so I though I would reach out for a hand.

    In the single.php file I have been using the next_post_link/previous_post_link as per the codex supplied by WP (https://codex.www.ads-software.com/Function_Reference/next_post_link).

    The second I change around the code from
    <?php next_post_link('%link', 'Next post in category', TRUE, '13'); ?>
    to
    <?php next_post_link('%link', 'Next post in category', FALSE, '58'); ?>
    things stop working.

    Any idea’s

    Cheers,
    Simon

Viewing 10 replies - 1 through 10 (of 10 total)
  • FALSE is the default, so just leave it out

    <?php next_post_link('%link', 'Next post in category', '', '58'); ?>

    Thread Starter sdjentertainment

    (@sdjentertainment)

    Hey Kegan,

    Thanks for the direction, I tried that out while I was doing some testing but wasn’t displaying the “Next post in category” link in any of the individual posts. (Only two posts out of 26 are in category 58)

    Any other ideas?

    hmm… try using a 0?

    <?php next_post_link('%link', 'Next post in category', 0, '58'); ?>

    Thread Starter sdjentertainment

    (@sdjentertainment)

    Does the same thing, any other suggestions?

    what are your categories?

    Thread Starter sdjentertainment

    (@sdjentertainment)

    They are set up through a custom taxonomy (project_categories) for a custom post type (projects). All the categories are used for sorting different projects so things like

    Design
    Digital
    Event
    Identity
    Illustration
    Installation
    Mobile
    Motion Graphics
    Print
    etc.

    But nothing that conflicts with the reserved terms of WP.

    everything is in the loop, correct?

    Thread Starter sdjentertainment

    (@sdjentertainment)

    yep

    try using it with no parameters…

    <?php next_post_link(); ?>

    Thread Starter sdjentertainment

    (@sdjentertainment)

    yeah, I did that in my initial testing, and it spits out the next post title as a link and everything works as expected. It’s just when I get to the 3rd and 4th paramater that things start disappearing.

    appreciating the help

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘next_post_link/previous_post_link exclude category’ is closed to new replies.