Support

Home Forums Event Espresso Premium How to hide more than one category with custom script?

How to hide more than one category with custom script?

Posted: March 31, 2022 at 10:53 am


scaldwell

March 31, 2022 at 10:53 am

Josh – you shared with me this code: https://gist.github.com/joshfeck/3777ceb1ba62a7acecd0adb89f0b7d1d

And I’m wondering how to hide more than one category using this… I’m not great shakes at Javascript so I don’t know where to add another ID.

Thank you so much!
Shelly


Tony

  • Support Staff

April 1, 2022 at 4:27 am

Hi Shelly,

You change this line:

$SQL .= " AND ID NOT IN (SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id=4 )";

To use an IN clause, like this:

$SQL .= " AND ID NOT IN (SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id IN (4,5) )";

The first line only uses a term id of 4, the second uses 4 and 5 (you can add more if needed, just separate each one with a comma).


scaldwell

April 6, 2022 at 1:13 pm

Yayyyy!!! WONDERFUL!!!

The support post ‘How to hide more than one category with custom script?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso