What is the function to show the advanced custom field meta box below the event title for ‘author_name’?
Is it best to add the function in the templates, or do you have a hook or filter function that I can use?
I have the field working in the event editor, but I can’t see how to show it on the front end.
Thanks.
You’ll likely need to add this to the theme template file. Event Espresso uses your sites theme to output the event details, so a hook would need to be within your theme rather than EE.
Would the author_name you are setting within ACF be different from the user set as the event author of the event?
Does your theme include the option to display post meta (which usually include the event author)?
The author name would be different to the post meta, think author e.g. Stephen King. We can relabel the ACF meta box to ‘play_author’ to avoid confusion.
What would the hook be for the event list page?
Would it be before the header </div> here?
The author name would be different to the post meta, think author e.g. Stephen King. We can relabel the ACF meta box to ‘play_author’ to avoid confusion.
Ahh, ok. I understand.
What would the hook be for the event list page?
Would it be before the header here?
There’s lots of hooks available within Event Espresso, but none that will allow you to output the event meta directly below the_title as its controlled by your theme. EE hooks into the_content and adds the details it needs to, the rest of the output is from your theme (including the title) so for that you’ll need to create a custom template and either add a hook you can use yourself or call the meta value directly from within the template.
Is this a hook you have found or are you asking if this is how you would use the hook? That is not a hook from within Event Espresso so I’m not sure where it is from, sorry.
Can you link me one of the pages you want to add this to?
I’ve managed to solve it, with your direction to focus on the theme.
To appear in the event list –
Added this
<div class="play_author"><h4><?php the_field('play_author'); ?></h4></div>
in the ‘content-espresso_events_header.php’
and the same again in the theme single.php to show in the event details.
How can we show the date range of multiple dates for each event please on the event list?
Example – June 18th, 2016 – June 20th, 2016
Move a copy of the espresso_event_date_range function into a site specific plugin and then look at the section for the time format and change time_range to start_time.
Any idea why just on non EE pages where we have the upcoming widget, there are now no event dates or times, but just the title of the event and image? – http://prntscr.com/a2c2wb
function espresso_list_of_event_dates() {
return espresso_event_date_range();
}
Your overriding a core function, with another core function but not passing any of the parameters to the function. On the single event page Event Espresso is smart enough to figure that out for you, however on a non EE page where there is no global event object there is no way for EE to know what it should be using unless you pass the event id.
We can not provide support for custom coding such as this, I recommend removing the custom function above and advise you seek help from a PHP developer that is familiar with WordPress to help you with these customizations.
What are the correct functions to show a) no end time for any events, b) also a date range for any multiple day events, c) without affecting the upcoming widget?
It turns out that espresso_list_of_event_dates()
and espresso_event_date_range() are the correct functions. You do not modify the functions to remove the times. Instead, you pass in an empty string to the time_format parameters when you call the function, where you don’t want the times to display. So for example if you look at the core code for espresso_event_date_range(), you’ll see that it accepts the following parameters in this order:
$date_format
$time_format
$single_date_format
$single_time_format
$EVT_ID
$echo
In your template where you call the function, where you don’t want the time to display, you pass an empty string for the time format parameters, like this ' ', and times will not be displayed there.
The support post ‘ACF after event title’ 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.
Support forum for Event Espresso 3 and Event Espresso 4.