Are there any variables specifically for virtual events? I looked through the list of XPHP variables in the docs but didn’t see anything mentioning virtual or online events. Specifically, I’d like to get the URL, special instructions, and whether it’s hybrid or not, but even just “is virtual” would be good to have.
<xphp var="events_is_online" />
<xphp var="events_online_type" />
<xphp var="details_online_url" />
<xphp var="details_online_button_label" />
<xphp var="details_online_instructions" />
Hi there,
In the event details component you’ll see this code, which gives you a starting point:
{[ if (obj.is_online) { ]}
{[ if (obj.online_url) { ]}
<a class="lw_join_online" href=" {{ obj.online_url }}">
{[ if (obj.online_button_label) { ]}
{{ obj.online_button_label }}
{[ } else { ]}
Join Event
{[ } ]}
</a>
{[ } ]}
{[ if (obj.online_instructions) { ]}
<div id="lw_cal_online_instructions">
{{ online_instructions }}
</div>
{[ } ]}
{[ } ]}
That is specifically to the event details view though – the widget editor will have its own versions though I believe they’re named all the same (is_online, online_url, online_button_label_, online_instructions). I’m not sure of a context in LiveWhale Calendar where you’d necessarily be accessing them as XPHP variables (XPHP tends to be page-wide information, compared to individual event results) but let us know if you want to share more context, we may be able to advise more thoroughly. Thanks!
Thank you both! To clarify, this is for a widget. I didn’t see any variables relating to online events under the field for widget HTML, which is why I was looking at XPHP variables instead. So, if I’m understanding correctly, I should be able to do this:
<field content="true">
<if var="events_is_online"/>
<content>
<div class="tcg_location-link">
<a href="{details_online_url}" target="_blank">
<u>Virtual Event</u>
</a>
</div>
</content>
</field>
However, it doesn’t seem to be working.
Using the helper buttons in the widget editor refreshes my memory that {online_url} is the widget-formatted variable for the url. I think you could also just use that for validation of an online event in this case?
So, using simple widget conditional:
{ <div class="tcg_location-link">
<a href="|online_url|" target="_blank">
<u>Virtual Event</u>
</a>
</div> }
or, using field logic:
<field content="true">
<if var="online_url"/>
<content>
<div class="tcg_location-link">
<a href="{online_url}" target="_blank">
<u>Virtual Event</u>
</a>
</div>
</content>
</field>
More about widget formatting: Widget Formatting - LiveWhale Support
I might also recommend replacing “Virtual Event” with something like {online_button_label}{!online_button_label:"Virtual Event"} – e.g., show the customized label if one exists, otherwise show Virtual Event.
Ah, actually… the solution was much simpler. I didn’t realize there were additional tags below the widget HTML field. I only just happened to notice the scrollbar appear when mousing over that part of the page. I have it working now with this:
<field content="true">
<if var="online_type"/>
<content>
<div class="tcg_location-link">
<a href="{online_url}" target="_blank">
<u>Virtual Event</u>
</a>
</div>
</content>
</field>
Which I see was in your suggestion. Thank you for the help!