Support

Home Forums Event Espresso Premium Conditional Tag Help

Conditional Tag Help

Posted: March 15, 2017 at 12:06 pm

Viewing 2 reply threads


mpseminars

March 15, 2017 at 12:06 pm

Hello, I’m using a widget login plugin to display widgets on certain event pages, depending on which category name they are in.

I can successfully target each page using this: is_single( ‘1786’ )
However, I need to target posts in a specific event category I created. I tried this code below, but it does not work.
has_term( ‘new-event’, ‘espresso_event_categories’ )

The event category I created has a slug of new-event

Any idea what I’m doing wrong? Thanks.


mpseminars

March 15, 2017 at 12:07 pm

CORRECTION: Widget *LOGIC* plugin is what I am using


Tony

  • Support Staff

March 16, 2017 at 6:35 am

Hi there,

The conditional tag you posted should work fine.

If I add a quick conditional to the single.php template in twentyfourteen – http://take.ms/NlnOE

Then view an event with that term it works as expected – http://take.ms/oN9Zb

So it seems to be an issue with the widget logic, possibly the point at which the code it running.

I’m guessing this plugin is the one you are using:

https://en-gb.wordpress.org/plugins/widget-logic/

If so, if you look within the support posts for the plugin you’ll find another report of has_term not working as expected here:

https://wordpress.org/support/topic/has_term-is_tax-doesnt-work/

Viewing 2 reply threads

The support post ‘Conditional Tag Help’ 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