WordPress.org

Forums

TPG Get Posts
[resolved] Boolean category query (4 posts)

  1. Jay Collier
    Member
    Posted 4 years ago #

    You mentioned that the plugin can select by multiple categories.

    Could you provide an example of a shortcode formatted to do so, with the results including only those posts which contain all the categories?

  2. cswaim
    Member
    Plugin Author

    Posted 4 years ago #

    There are 2 ways to show posts by category

    1) by category name

    [tpg_get_posts category_name="cat1,cat2"]

    2) by category id

    [tpg_get_posts category="2,4,8"]

  3. Jay Collier
    Member
    Posted 4 years ago #

    Just want to make sure. In 2, will the results include posts that are in ALL the categories (boolean-and) or in ANY one of the three (boolean-or)?

  4. cswaim
    Member
    Plugin Author

    Posted 4 years ago #

    In both cases, the logic within a single selection group is OR logic. So posts that meet any one category is selected. If you list multiple selection tags, ie tags='xxx' category='yyy', this forms an AND condition.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TPG Get Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic