Ready to get started?Download WordPress


One Category's Posts only (NOT subcategory posts) (7 posts)

  1. dhkeller
    Posted 9 years ago #

    Still looking for a solution to the problem described earlier: http://wordpress.org/support/topic.php?id=24473

    I'd like to show all of the posts from a given category on each catergory page, but I don't want to display posts from subcategories. How do I stop the children from displaying?

    Thought I had an answer, but while it achieved my goal on the category views, it resulted in empty pages for all searches and individual post pages. Oops.

    Does anyone have a better solution?

  2. dhkeller
    Posted 9 years ago #

    bump .... any ideas?

  3. Minna
    Posted 9 years ago #

    See if this post by Andrew Hall and/or my comment below it help. That was for WP1.2 so maybe the line numbers don't match. If you can't figure out where to find that, holler and I'll dig into the code :)

    Oh, eh, sorry... you figured out that it doesn't work. Do you know why it doesn't?

    Actually, never mind :) I'm trying something out right now. The places where you need to comment out things have moved a little.

  4. Minna
    Posted 9 years ago #

    OK now. Are you a brave spirit? :) This is for the latest,, probably applies for 1.5.1. too

    1) Make a backup of the file classes.php found in wp-includes
    2) Comment out lines 393, 396, 420; to spot them, look for "Category stuff" + "Category stuff for nice URIs" and comment out (add two forward slashes at the beginning of the line) the lines starting with $whichcat .= get_category_children - there are 3
    3) upload the new classes.php

    That should do it.

  5. SSTV
    Posted 9 years ago #

    I love you for that ;) .. thx, works perfectly

    My Blog

  6. gerhardb
    Posted 9 years ago #

    @minna, an all

    for wp2.0 comment lines:

    an the world is fine

  7. RichH
    Posted 8 years ago #

    I had this problem; I think this little plugin will solve it quite for WP 2.0.x without editing source:

    No SubCats plugin

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.