Hello, I am new to EE4 and have a venue setup that is virtual but I cannot find a way to show the virtual url or call-in number on my event view.
Is there a way to do this? I see in the template the event phone number is being outputted with espresso_event_phone( $post->ID, FALSE ); but I am looking for how to add venue virtual information for reusability.
If you are familiar with PHP and OOP you can get to that field pretty easily using our models.
If you are within the loop and have the the EE_Event object already you can use:
//Pull an array of all venue objects assigned to the event
$venue = $event->venues();
//Check venues were actually returned. Shirt the first venue object from the array.
$venue = !empty( $venue ) ? array_shift( $venue ) : NULL;
//Use the venue objecy methods to out the virtual_url
if ( $venue instanceof EE_Venue ) {
echo $venue->virtual_url();
}
Or We also have helper functions available to do most of this, for example:
//You may need to call the helper, it depends where you are using this
EE_Registry::instance()->load_helper('Venue_View');
//Returns the first venue object it finds for the event.
$venue = EEH_Venue_View::get_venue();
//Use the venue object methods to output the virtual_url
if ( $venue instanceof EE_Venue ) {
echo $venue->virtual_url();
}
Which you use and how you do it depends on where you are using this code and what you are using it for.
Does that help?
Viewing 3 reply threads
The support post ‘Virtual Location Information’ 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.
Support forum for Event Espresso 3 and Event Espresso 4.