Display Posts Shortcode
[resolved] Posts in two categories (5 posts)

  1. richardjay
    Posted 2 years ago #

    Is it possible to return excerpts of only those posts that are in the "forex-2" and "reviews" categories ? At the moment I'm getting any post in either category.


  2. Bill Erickson
    Plugin Author

    Posted 2 years ago #

    I haven't tried it, but this might work:

    [display-posts category="forex-2+reviews"]

  3. Jeffrey Driver
    Posted 2 years ago #

    Glad I found this post. I was just looking for the same thing. However, it doesn't seem to work (at least not how I was hoping it would) as it will return posts with either one of the given categories, and not just those with both. At the moment I'm having to create long, descriptive categories.

    It would be great to see some boolean operators to help filter results further. This would make an already great plugin much more powerful.

  4. Bill Erickson
    Plugin Author

    Posted 2 years ago #

    I thought the + was a shorthand for boolean operators in WordPress, but I guess not.

    Boolean operators are supported, it's just a little more complicated:

    [display-posts taxonomy="category" tax_term="forex-2, reviews" tax_operator="AND"]

    You can even do the intersections or additions of multiple taxonomies. Let's say you want posts in the "forex-2" AND "reviews" category, AND it should be tagged "featured" AND "home".

    [display-posts taxonomy="category" tax_term="forex-2, reviews" tax_operator="AND" taxonomy_2="post_tag" tax_2_term="featured, home" tax_2_operator="AND" tax_relation="AND"]

    For more information, see the Multiple Taxonomy Queries section of the wiki.

  5. Jeffrey Driver
    Posted 2 years ago #

    That's fantastic. Thanks a lot Bill.

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.