Skip Navigation

[Resolved] Conditionals on The Event calendar

This support ticket is created 4 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 4 years, 1 month ago.

Assisted by: Jamal.

Author
Posts
#1843273

When website of Organiser is empty hide this .

I've tried with this shortcode and conditional

[wpv-conditional if="( $(_OrganizerWebsite) ne '' )"]
Website: [wpv-post-field name='_OrganizerWebsite' id='[wpv-post-field name="_EventOrganizerID"]']
[/wpv-conditional]

What am I doing wrong here?

I've also tried to use _EventOrganizerID in conditional

#1844203

Hello and thank you for contacting the Toolset support.

I am not sure of the following assumptions and the names of the plugin's custom post types :
- _OrganizerWebsite is a custom field of the "Organizer" custom post type.
- _EventOrganizerID is a custom field of the "Event" custom post type. It holds the "Organizer" post id.

If the above is correct, I'll suggest that you use an intermediary content template. And include it by passing the item attribute:

[wpv-post-body view_template="the intermediary content template" item="[wpv-post-field name="_EventOrganizerID"]"]

As we will be passing the Organizer object to this content template, "_OrganizerWebsite" will evaluate inside the conditional, and we won't need to pass the organizer id any more, something like:

[wpv-conditional if="( $(_OrganizerWebsite) ne '' )"]
Website: <a href="[wpv-post-field name='_OrganizerWebsite']" target="_blank" rel="noopener">[wpv-post-field name='_OrganizerWebsite']</a>
[/wpv-conditional]

Does it make sense?
Check the following articles:
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153372

I hope this helps. Let me know if you have any questions.