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

  1. rquattro
    Posted 2 years 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.



  2. Bill Erickson
    Plugin Author

    Posted 2 years 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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Display Posts Shortcode
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.