WordPress.org

Ready to get started?Download WordPress

Forums

Next/Previous 'TRUE' parameter not working (6 posts)

  1. PyroPawz
    Member
    Posted 6 years ago #

    The post has three categories: 12, 13, and 16. I want to use the next/previous links in each post to link to the next or previous post in category 12. So I wrote the following code:

    <?php previous_post_link('&laquo; %link', 'Previous', TRUE, '13 and 16'); ?>
    <?php next_post_link('%link &raquo;', 'Next', TRUE, '13 and 16'); ?>

    But when I go to the post after saving, I get links to the previous post which has category 13, and the next post which has category 16. (Neither has category 12 just to be clear.)

    I am using Exec-PHP version 4.7 to be able to put php code in my post itself. Could this plug-in somehow be messing with the function, or am I perhaps missing syntax somewhere? Any help would be appreciated.

  2. PyroPawz
    Member
    Posted 6 years ago #

    Bump for an answer? Any ideas why this function is not working the way it's supposed to?

  3. iridiax
    Member
    Posted 6 years ago #

    Try taking it out of the post itself and using it within the loop on single.php. Does this work?

  4. PyroPawz
    Member
    Posted 6 years ago #

    No it's not. I put in to skip category 12 and it's going to those posts anyway.

    <?php previous_post_link('&laquo; %link', 'Previous post in category: %title', TRUE, '12'); ?>
    					<?php next_post_link('%link &raquo;', 'Next post in category: %title', TRUE, '12'); ?>
  5. iridiax
    Member
    Posted 6 years ago #

    Just for the heck of it, have you tried using commas between the excluded categories instead of ' and '? There was a weird little note about doing this for WordPress 2.2 in the Codex, but I don't know if it is also for later versions:

    http://codex.wordpress.org/Template_Tags/next_post_link

  6. PyroPawz
    Member
    Posted 6 years ago #

    Nope, still not working, either in single.php or in post.

Topic Closed

This topic has been closed to new replies.

About this Topic