WordPress.org

Ready to get started?Download WordPress

Forums

Child post showing up in parent category (3 posts)

  1. mb168
    Member
    Posted 6 years ago #

    I finally pulled the trigger on switching my static site to WP and started trying to recreate some of my pages, http://www.bigbie.net. I'm using Brian Gardner's free Revolution blog theme but attempting to make a few hacks to suit my site such as one category, News, appears on the Home page. I've created a category called Kids and a subcat called Kellie and placed a test post in each, however the post in the subcat Kellie is also appearing on the Kids category page. I've searched through the template tags and used every combination of in_category and query_posts to display only the Kids posts on that page or exclude the Kellie posts from that page I could think of. I'm not certain if these particular tags are the right way to produce my results or if I'm putting them in the wrong place. My last resort is to remove the Kids category all together and make a Kids Page, and a page and category for each kid, and then query_posts on the appropriate kid category on their Page and hide all categories and subcats.

    My end goal was to have no categories showing up in the right nav and both categories and pages would appear in the top nav with dropdowns to the sub cats/pages. Only the Kids (and the subcats for each kid) and News categories would actually have blogs while the rest of the site would be static pages.

    Which way seems the "most logical"?

  2. mb168
    Member
    Posted 6 years ago #

    Also, if I make a page and query posts to that page, will it still use my global settings for how many per page and what happens when it gets more than that setting, does it make a new Page for older?

  3. vickilh2
    Member
    Posted 5 years ago #

    This worked for me, including only category & excluding child:

    <?php if (is_category('slug-for-category')) { ?>
    <?php $posts = query_posts("&cat=8,-25&orderby=post_date&order=asc&posts_per_page=30&paged=$page"); ?>
    <?php } else { ?>
    <?php $posts = query_posts($query_string.'&orderby=post_date&order=asc&posts_per_page=30&paged=$page'); ?>
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.