I have added (with ACF) some custom fields in Event Details with sponsor information including a sponsor logo. Works as expected on the event details page, great. I would like to include that logo at the bottom of the content on the Event Archive page. This also involves the People addon.
People description is automatically loaded to event archive, great!
I created an archive-espresso-events file, placed in child-theme.
In admin panel disabled Use Custom Display Order
Commented add_filter… in content-espresso_events
Made modification to that file, okay
Now I lose the People description with those modifications
So,
I would like to add the sponsor logo at the bottom of each event archive entry
After disabling “Use Custom Display Order” in the admin panel, I opened the file
content-espresso_events and in the commented instructions it says to “if you are creating a custom template based on this file,
* and do not wish to use the template display order controls in the admin,
* then remove the following filter” => //add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_true' );
It may be too late to hook a callback function to AHEE_event_details_before_the_content directly in the template. Usually these are added to the theme’s functions.php file or even better into a site specific plugin.
The ee_event_sponsor_logo() function would be best moved into a functions file too.
With regards to the ee_event_sponsor_logo() function, it doesn’t appear to have any means of checking for the current post ID. the AHEE_event_details_before_the_content action hook can access the $post object, so the following changes to your code will ensure you have the correct post to work with:
Since you mentioned you’re already editing the content-espresso_events.php you could also add the markup directly to that template to add the sponsor logo instead of using the action hook.
You can also copy the code from the People add-on’s /public/templates/content-espresso_events-people.php template into your custom templates. Please be sure to put the custom templates into a child theme to load them from there in case you need to update the WP theme later.
I incorporated that code and added a bit to hide the div if the value XXX is empty now the div is hidden when empty but I am getting the image and the image URL when it’s true. What am I missing?
I incorporated that code and added a bit to hide the div if the value XXX is empty now the div is hidden when empty but I am getting the image and the image URL when it’s true.
Is that a typo?
You are getting the image URL when its true? That seems to be the expected output.
Argh! Yes, that was a typo, it was a placeholder for “sponsor_logo_image”. What is happening is that I am getting the image and it is linked but I am also getting the image URL in text written just to the right of the image. I do not want the image URL to be visble.
The support post ‘Customizing Event Archives and People Archives’ 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.