Support

Home Forums Event Espresso Premium Adding a custom field when creating an event and display that with event listing

Adding a custom field when creating an event and display that with event listing

Posted: December 13, 2019 at 6:46 am

Viewing 2 reply threads


tneumann

December 13, 2019 at 6:46 am

Good morning,

I have read a number of posts here, and maybe I am missing the one that answers this, but here is what I would like to do…

I would like to create a checkbox field type, preferrable with Advanced Custom Fields (but I would consider another approach) where I could define a list of choices to select from. I would have two or more choices available in that checkbox field.

When I am adding or editing an event, I would like to be able to see that checkbox field and for each event make a selection of one or more of the choices there. I would like that selection to be unique to each event it is associated with. I.E. event one has choice one selected, but event two might have choices 2 and 4 selected.

When that event is displayed, I would like to programmatically build an array of the selected choices and then display them in my output. As you can in the link provided here:

http://softliteworkshops.com/events/ws-2020042301/

I have created a custom single-espresso_events.php and I am using that to create the custom event listing I wanted displayed. If you look at the icons being displayed in the middle of that page, you can see I am retrieving event data (Start and Stop dates, Prices, Location, etc.) I would like to be to do the same with data for “Guides” and “Difficult” so my custom fields would ultimately be programmatically loaded and the data added to this icon block.

Any help here would be greatly appreciated!

Thanks,
Tim


Josh

  • Support Staff

December 13, 2019 at 7:58 am

Hi Tim,

If you want to build out an array of values, and you’re already using ACF, you could start with using this function to get each of your values:

https://www.advancedcustomfields.com/resources/get_field/

or you could also display an individual field with

https://www.advancedcustomfields.com/resources/the_field/


tneumann

December 16, 2019 at 6:49 pm

Hey Josh,

Thank you for the assistance! I was expecting this to be much harder, I associated the Field Group with an Event post and there it was.

Thanks for pointing out the functions to retrieve the data entered in the event add/edit screen.

Tim

Viewing 2 reply threads

The support post ‘Adding a custom field when creating an event and display that with event listing’ 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