WordPress.org

Ready to get started?Download WordPress

Forums

Exclude category from single post navigation (prev/next) (12 posts)

  1. Berko
    Member
    Posted 8 years ago #

    I am using the WP-iCal plugin from Garrick Van Buren and I don't want my calendar category to show up anywhere in the blog. I have managed to exclude it from the loop and from the category listing, but when I view individual posts, the posts from my calendar category show up as previous/next posts. Anyone know how to keep them from showing up there?

  2. Berko
    Member
    Posted 8 years ago #

    previous_post_link and next_post_link have provision for excluding categories, but there is a bug in WP that keeps it from working. The function looks for the excluded category numbers in the posts table rather than post2cat. Hopefully this will be fixed soon.

  3. Elliott
    Member
    Posted 8 years ago #

    Does anyone know what the bug is and how we can fix it instead of waiting for a fix to be released? I had this working in 1.5.2 and now it's broken in 2.0........

  4. Elliott
    Member
    Posted 8 years ago #

    I found this patch here: http://trac.wordpress.org/ticket/2215

    However, it doesn't support mutliple categories like previous WP versions. Does someone have a TRAC account that would like to reopen this ticket?

    That'd be great....

  5. Berko
    Member
    Posted 8 years ago #

    @ielliot: I reopened the ticket with some clarifying notes. I hope this results in a fix soon. I too saw the patch, but it didn't work for me.

  6. mqstultz
    Member
    Posted 8 years ago #

    Hey... newbie here...

    I just run into this same problem: Posts from an excluded category are still showing up in my previous and next post links in the single.php template.

    The following code is not working for me:
    <?php previous_post('%','Previous','no','','','1 and 11'); ?>

    I've tried it excluding only one category, as integer, as string, with default values for all other variables, without, etc... The categories are not being excluded from the links... even if I assign the post to only one category and only exclude that one.

    Not sure if I'm reading this right, but the bug reported in ticket 2215 appears to be fixed?

    If so, could someone please tell me what I need to do to get the fix?

    (I'm not a developer, so I'm not quite sure of what to do with the attachments on those tickets..)

    thanks in advance...

  7. mqstultz
    Member
    Posted 8 years ago #

    Somehow I was able to apply the patch mentioned above, and it seems to be working for me even when I exclude multiple categories.

    The trick -appears to be- is to list the excluded categories in descending order.

    So '1 and 11 and 19' didn't work
    But '19 and 11 and 1' seems to work perfectly.

  8. wwjoe
    Member
    Posted 8 years ago #

    Another noob with similar problems. When I click on a Post and it is opened in it's own, single page, I would like to restrict the navigation links to only go to posts in the SAME Category. After clicking the link posted by ielliot for the fix, I have no idea what that page full of code is or what to do with it... oh..

    Any help fixing this really appreceiated, thanks!

  9. mqstultz
    Member
    Posted 8 years ago #

    Joe,
    I don't think the patch mentioned here is what you need to solve your issue.

    Limiting previous/next navigation to posts in the same category works as expected with the previous_post() and next_post() functions documented here.

    Notice the "in_same_cat" parameter.

  10. ReDirEct1
    Member
    Posted 8 years ago #

    Hi... there is a way to exclude multiple categories in 2.0.2 in single post view? I have patched the file with the changeset 3508 http://trac.wordpress.org/changeset/3508 ... But it exclude only one category. Also trying in descending order...only the last categories in the order it's excluded

  11. dannybcastillo
    Member
    Posted 7 years ago #

    Has anyone figure out how to exclude multiple categories with the http://trac.wordpress.org/changeset/3508 fix.
    I can only exclude one category.
    wp 2.0.3

  12. mae
    Member
    Posted 7 years ago #

    implement the fix and create a parent category then make the categories you want hidden to be its children... :) hope I made sense...

Topic Closed

This topic has been closed to new replies.

About this Topic