AND rather than OR for categories in Shortcode

in Download Manager Free

  • This topic has 4 replies, 2 voices, and was last updated 10 years ago by etc.
Viewing 5 posts - 1 through 5 (of 5 total)
Nov 7, 2014 at 8:44 pm
#22282
Member
etc
OP

Using 2.7 free version.

I would like to use a shortcode to display items that match 2 categories. However, when I put “category-one,category-two” in the shortcode, separated by a comma, it treats this as an OR and returns items matching either of the two. Is there a way to make this match only those items that are in both categories?

Nov 8, 2014 at 9:41 am
#22310
Keymaster
Shahjada
Staff

You need to edit code at functions.php line# 741 ~ 749

Nov 10, 2014 at 2:35 pm
#22359
Member
etc
OP

Thank you for pointing me to the right place!

I merely had to add one line to the tax_query array to get the desired functionality.

'operator' ► 'AND'

I appreciate your time and really like this plugin.

Nov 14, 2014 at 8:20 pm
#22548
Keymaster
Shahjada
Staff

thanks, if you like the plugin, please give it a 5* rating here https://wordpress.org/support/view/plugin-reviews/download-manager?rate=5#postform 🙂

Mar 7, 2016 at 3:23 pm
#42023
Member
etc
OP

I just found that your latest version makes $operator a variable…and I have now been able to set operator=AND in my shortcodes. No more manual edits every time I update the plugin!

Thank you for making this modification, and continued success. I use this plugin on multiple sites and it does what I need.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic "AND rather than OR for categories in Shortcode" is closed to new replies.