Support

Home Forums Event Espresso Premium Displaying custom field in event description

Displaying custom field in event description

Posted: December 16, 2016 at 4:56 pm

Viewing 1 reply thread


rhj4

December 16, 2016 at 4:56 pm

Some of my events will be “Residential” meaning that the ticket price includes a room, bed and six meals. I have added “Residential” as a custom field to each venue. I want to be able to show this value in the event description. How do I pull a custom field from an event venue into the event description?


Tony

  • Support Staff

December 19, 2016 at 7:21 am

Hi there,

It depends on where exactly within the event details you want to output the custom field as to how you do this.

The venues are custom post types so you can pull the custom fields in the same way you would any other post if preferred, for example you can use ACF and then use the the [acf field] shortcode, passing the post_id of your venue.

Or you can use a snippet such as this one: http://wpsnipp.com/index.php/functions-php/get-custom-field-value-with-shortcode/

To add your own shortcode that pulls in custom fields trough shortcodes.

Another option is to use the hooks available within EE that are fired during the output of the event details, for example the AHEE_event_details_before_venue_details passes the $post, so from that you can pull the event and its venue, then the custom field from the venue.

Something like this:

https://gist.github.com/Pebblo/34be6a88ce4c16d17c8614ff6a919d18

Viewing 1 reply thread

The support post ‘Displaying custom field in event description’ 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