Support

Home Forums Event Espresso Premium Need to add the Venue City to the Upcoming Events Widget EE4

Need to add the Venue City to the Upcoming Events Widget EE4

Posted: November 2, 2014 at 5:17 am

Viewing 3 reply threads


Adele Haswell

November 2, 2014 at 5:17 am

Wordpress v4.0 and EE4
I need to add just the city name from the Event venue to the Upcoming Events widget. I have setup a site specific plugin (as per this https://eventespresso.com/topic/attempting-to-customize-upcoming-events-widget-no-widget-php-available/) to make customisations to it and all is working but I can’t figure out how to call just the city from the Venue.


Josh

  • Support Staff

November 3, 2014 at 1:12 pm

Hi Adele,

Here’s one way to get the Venue city:

$venue_obj = $event->venues();
$venue_obj = !empty( $venue_obj ) ? array_shift( $venue_obj ) : NULL;
if ( $venue_obj instanceof EE_Venue ) {
    $city = $venue_obj->city();
    echo 'City: ' . $city;
}


Adele Haswell

November 6, 2014 at 8:22 pm

Thanks!

That did the trick.


Dean

November 7, 2014 at 3:13 am

Hi,

Anything else we can help with in regard to this topic or can we mark this as resolved?

Viewing 3 reply threads

The support post ‘Need to add the Venue City to the Upcoming Events Widget EE4’ 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