WordPress.org

Ready to get started?Download WordPress

Forums

I don't want Children to show-up (3 posts)

  1. dhkeller
    Member
    Posted 9 years ago #

    When viewing all posts in a category, the display includes all children. I'd like to show only the posts actually in the parent category, not the children. How do I do tht in 1.5?

    I think the same question is asked here: http://wordpress.org/support/topic.php?id=4736#post-136715, but no answer.

    This solution (http://www.andrew-hall-artist.com/journal/index.php?p=69) worked under 1.2, but doesn't seem to apply to 1.5.

  2. dhkeller
    Member
    Posted 9 years ago #

    No reply from anyone, but researching today produced another workable clue:

    http://codex.wordpress.org/The_Loop

    which led to ...

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

    The in_category function can be used by designating the "$cat" variable as the passed value, with the entire "post" div placed inside the if loop:

    <?php if ((in_category($cat))): ?>

    <div class="post"> ... </div>

    <?php endif; ?>

    Seems to work ..... Did I break it? .... or is this an obvious solution I should have found sooner?

  3. That sure is a solution, but it sure isn't "obvious". I'm glad you found one nonetheless. Congrats.

    (FYI, you may want to try a different topic title next time. I almost didn't click on this because I thought it was a spam topic about birth control. Heh, but it's all in good humor. ^_-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.