Support

Home Forums Event Espresso Premium Adding Custom Fields to an Event (EE4)

Adding Custom Fields to an Event (EE4)

Posted: May 14, 2017 at 1:37 am

Viewing 5 reply threads


jbbruning

May 14, 2017 at 1:37 am

Hi there,

Just a quick message to see if there is an existing function to add custom fields into the single events page? Ideally positioned somewhere at the end of the ‘event’, and before ‘location’.

Many thanks in advance : )


Tony

  • Support Staff

May 15, 2017 at 5:08 am

Hi there,

We have a lot of hooks within EE so it usually possible to output additional details when needed.

In this case, you could use the AHEE_event_details_after_event_date action hook.

For example:

function tw_ee_after_event_date( $post ) {
    echo "Hello World";
}
add_action( 'AHEE_event_details_after_event_date', 'tw_ee_after_event_date' );

You’ve mentioned custom field but not how your adding those field to the event, if they are just standard custom fields you have the $post passed to the action so you can output them as you would any other.

Note – Event Espresso allows you to change the order of the event details that are output, the hook above is a part of the datetimes section, meaning if you move where you’re datetimes are displayed, you also move that hook to the new location and therefore your custom output.


jbbruning

May 15, 2017 at 5:22 am

Thanks Tony : )

It’s actually a custom field create with the ACF plugin. It’s actually a request for a user to let us know if they have any specific dietary requirements.

So, if ‘yes’ then fill in the space. If ‘no’ end.

I will need to capture the input they provide within event details (admin), would this change the structure of the above?


Tony

  • Support Staff

May 15, 2017 at 5:29 am

Can I ask why you are not using a custom question for this?

I’m not sure how you will be capturing details for registration from within the event details page, the registration hasn’t started then?


jbbruning

May 15, 2017 at 5:33 am

ahhh, if there is an out-the-box solution that would be awesome. i must have missed that. where do custom questions reside?

sorry, i wasn’t clear. i wanted to provide a means for someone to provide details as to whether they had a dietary requirement when they registered.

sounds like the custom questions is what i need.


Tony

  • Support Staff

May 15, 2017 at 5:51 am

Yeah, it sounds like you need custom questions.

You can add additional questions to the registration form within:

Event Espresso -> Registration Forms -> Questions.

You will need to assign them to a ‘Question Group’ for them to display on the form, there is a default ‘Personal information’ question group or again you can create your own custom groups and include various questions within each.

You then select the question group;s you want to ask on each specific Event using the settings in the event editor, which looks like this – http://take.ms/1CBvc

(Note the ‘Personal Information’ question group is required for the ‘Primary registrant)

We have some documentation on custom questions/question groups here:

https://eventespresso.com/wiki/add-questions-event-espresso-question-groups/

Viewing 5 reply threads

The support post ‘Adding Custom Fields to an Event (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