Support

Home Forums Event Espresso Premium Adding Custom Field in Event Header (EE4)

Adding Custom Field in Event Header (EE4)

Posted: April 13, 2016 at 9:30 pm


creativephoto

April 13, 2016 at 9:30 pm

What I am looking to do is add another pricing field (or two) to the event details header.

Current header displayed is:
Event title (datetime)
date
time

What I want to do is add another field, maybe two, to be editable in the event editing platform and displayed under the time block in the header. The reason is that I sell tickets that are just deposits towards a total price due at the door and the new field(s) will allow me to show the total price to customers to make that price clearer to them (currently I just add the total price in the description section.

I am sure it is likely simple coding that needs to be added in two or more files, but I am not sure which files and what necessarily needs to be added. Any help would be appreciated as it will cut down my time to do it myself.


Tony

  • Support Staff

April 14, 2016 at 4:49 am

Hi,

It sounds like what your calling the header, we refer to as the datetime list, can you post an example/screenshot so we can see exactly where you are referring to please?

It should be possible with post (event) meta and then just displaying the meta within the template but it depends on where exactly you want to output the data.

Also, please do not edit Event Espresso core files, we can not provide support for modified version of our code. Generally there will be a hook available to add additional details or it can be down through the template files used to display the details.


creativephoto

April 14, 2016 at 6:31 am

Tony,

Thank you for the quick reply. Chances are that you are correct in my reference, here is a screenshot:
Screen Shot

So far, I have added a field for “Event Cost” and using hooks can get it to place before content, but that only works for description in the event lists (shortcodes) and not in the event page itself. What I would really like is to add it in one of the 2 red areas as illustrated in the screenshot. Currently, the event cost info (yellow area) is simply text added to the event content.

So, I guess what I need to know is where to add the coding to get the info to display in one of those areas (Option 2 I am sure is easiest). I suspect the coding I used to get the field displayed in the hook would work, but just need to add it to the new area/file.


Tony

  • Support Staff

April 14, 2016 at 8:05 am

For both options there is the ‘AHEE_event_details_after_event_date’ hook which is fired just after the output of the datetimes.

It is passed the $post object:

do_action( 'AHEE_event_details_after_event_date', $post );

So you can do something like this:

https://gist.github.com/Pebblo/8994a8abe05f0717d9f9ced5eec6294a

If you wrap the output within a div you can then apply styles to your liking.

Is that what you are looking for?


creativephoto

April 14, 2016 at 9:59 am

Tony,

Yes, that worked. I added a string to the code for the text I wanted to add to it, but it now appears there correctly using the custom field I created before:

Screen Shot

I may play with the div wrap to change its appearance, but I am happy with the output as is as well.

Thank you for your assistance and have a wonderful day!


Tony

  • Support Staff

April 14, 2016 at 10:08 am

You’re most welcome and you too 🙂

The support post ‘Adding Custom Field in Event Header (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