Support

Home Forums Event Espresso Premium How to echo venue name (Grid Add On)

How to echo venue name (Grid Add On)

Posted: July 16, 2017 at 10:47 pm

Viewing 2 reply threads


Adam

July 16, 2017 at 10:47 pm

Hello,

How can we echo the venue name for the current event in:
espresso-grid-template.template.php

Thanks


Adam

July 17, 2017 at 4:30 am

all sorted thanks anyway


Tony

  • Support Staff

July 17, 2017 at 5:07 am

Hi there,

I’m glad you have this sorted.

There’s a few different ways to pull the venue info, for future reference you could use the venue view helper by first loading it within your template:

// Load Venue View Helper
EE_Registry::instance()->load_helper('Venue_View');

Then you have the functions within the ‘EEH_Venue_View’ class.

Or you can use the template tags we have available within EE:

espresso_venue_name()

Or if you want the EE_Venue object you can pull that from the event, so if you have a $post object, you can use:

$venues =$post->EE_Event->venues();

Which returns an array of venue objects (yes even if there is a single venue)

Then pull the single venues object from that:

$venue = reset($venues);

And finally, output name of the venue $venue->name();

The help classes do a lot of the above for you and also do a lot of conditional checking to try and pull the venue from the correct object and make sure you have a venue object before trying to return values from it.

Viewing 2 reply threads

The support post ‘How to echo venue name (Grid Add On)’ 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