WordPress.org

Ready to get started?Download WordPress

Forums

Display Posts Shortcode
[resolved] show posts from multiple categories? (9 posts)

  1. jmichaelk
    Member
    Posted 2 years ago #

    Is it possible to summon posts from two categories, instead of just one? If so, how would I add the second category into the standard tag? I see a response from you about adding multiple tags with and/or operators. Will the same apply to categories? For example, "NameOfCategory1+NameOfCategory2"? Thank you.

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

  2. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, using + should show posts that are in both those categories (AND operator). Using a comma will show posts that are in either of those categories (OR operator). More info here: http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

  3. jmichaelk
    Member
    Posted 2 years ago #

    thanks!

  4. FaffeF
    Member
    Posted 2 years ago #

    Is it possible to get this to work with tax_term as well?

  5. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    I've just pushed a small update (didn't change version number) that adds support for multiple taxonomy terms and the taxonomy operator.

    [display-posts taxonomy="post_tag" tax_term="austin, lake"]
    This will show posts tagged austin OR lake (if no operator is applied, it uses tax_operator="IN")

    [display-posts taxonomy="post_tag" tax_term="austin, lake" tax_operator="AND"]
    That will show posts tagged Austin AND lake

    [display-posts taxonomy="post_tag" tax_term="austin, lake" tax_operator="NOT IN"]
    This will show posts not tagged austin or lake.

  6. FaffeF
    Member
    Posted 2 years ago #

    Thanks!

    Why not update the version number? Now I must update manually to get the changes. Isn't it kind of defeating the purpose of version numbers to release changes without changing the numbers?

  7. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    Because this is such a minor change (and specifically designed for you), there's no reason to prompt the many other people to update.

  8. ryansmithsd
    Member
    Posted 2 years ago #

    in the same idea as this- what about doing this for custom post -types like Projects or Portfolio-- looked in the forum first but didnt see anything. Thank you such an amazing project!!!

  9. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    Post type is one of the default parameters of the shortcode. So if your post type is called "portfolio",

    [display-posts post_type="portfolio"]

    will show the 10 most recent posts in that post type

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic