• Resolved petroglyphic

    (@petroglyphic)


    What is the loop syntax to display posts from category a but exclude posts that are also tagged with category b?
    If I use [loop category=a category=b compare=not] I get the results from [loop category=a,b compare=and]
    If I use [loop category=a,b compare=not] I get the results of [loop category=a,b] which is compare=or.
    It would be very helpful if the category include is specified separately from the category exclude, so each part can contain more than 1 category.

    https://wordpress.org/plugins/custom-content-shortcode/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    What is the loop syntax to display posts from category a but exclude posts that are also tagged with category b?

    I believe you can achieve it with the taxonomy parameter:

    [loop taxonomy=category term=a relation=and taxonomy_2=category term_2=b compare_2=not]
    Thread Starter petroglyphic

    (@petroglyphic)

    That’s it, thank you!
    It might be helpful if you added an example to the documentation – I saw the description, but wasn’t sure how/where to put the “relation=” and also got confused by the commas, since the shortcodes don’t use commas.
    Great plugin.

    Plugin Author Eliot Akira

    (@miyarakira)

    Thanks for confirming that it works. Good idea, I’ll try to think of more examples to include in the documentation.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show category a, exclude category b’ is closed to new replies.