WordPress.org

Ready to get started?Download WordPress

Forums

Display Posts Shortcode
[resolved] Would not view Sub Categories (2 posts)

  1. rquattro
    Member
    Posted 11 months ago #

    Hi All,

    I would not view subcategories. If I use [display-posts category="name"] and "name" has 2 subcategories, I see posts of 3 item: "name"+ 2 subcategories.

    How can I view only posts of category "name"?

    I tried with [post_parent="0"] but don't work.

    Tks,
    Robert

    http://wordpress.org/plugins/display-posts-shortcode/

  2. Bill Erickson
    Member
    Plugin Author

    Posted 11 months ago #

    Unfortunately that's just how WordPress works. Child categories (subcategories) are contained within parent categories, so all posts in a subcategory are also in the parent category.

    You might be able to use the taxonomy parameters to craft a complex query where you list the categories included (parent category) AND list the categories excluded (all the sub-categories). See the bottom of the wiki for more information: https://github.com/billerickson/display-posts-shortcode/wiki

    Untested, but something like this might work: [display-posts taxonomy="category" tax_term="parent_category" taxonomy_2="category" tax_2_term="child_cat_1, child_cat_2" tax_2_operator="NOT IN"]

    Providing additional assistance is beyond the free support I offer.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.