Support

Home Forums Event Espresso Premium How to stop the_content injection when using custom template?

How to stop the_content injection when using custom template?

Posted: July 1, 2022 at 12:51 pm

Viewing 5 reply threads


bakerrisk

July 1, 2022 at 12:51 pm

We are using a custom template that we selected from the “Page template” option for a single event. We are trying to stop the ticket selector, date and time, and venue from getting injected into the_content. Our template already has these parts included in the template so we don’t want them injected with the description.

We added the filter to the theme’s functions.php:
add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_false' );
but that didn’t work so we also tried removing and changing the add filter priority from this topic but it’s still being injected.

Is there something we’re missing to prevent the injection into the_content?


Tony

  • Support Staff

July 4, 2022 at 5:13 am

Hi there,

To prevent the_content injection, this filter:

add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_false' );

Should be:

add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_true' );

Using __return_false tells the condition to continue as it does now, __return_true tells EE you are wanting to use a custom template.


bakerrisk

July 5, 2022 at 8:47 am

Thanks for the clarification. Unfortunately the event’s details are still getting injected into the the_content() after the description.

We changed the function to __return_true but it didn’t work so we tried changing the priority too. The following functions are currently in the theme’s functions.php:

remove_all_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template');
add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_true', 11 );

I forgot to mention this course is “hidden” by excluding it from the archive page using this code snippet and is also password protected. Does it make a difference if the event is password protected?

Is there something else we can try?


bakerrisk

July 5, 2022 at 9:00 am

I just checked the other events and the event’s details were getting injected after the event description in the custom single-espresso_events.php template we are using.

I changed the function back to __return_false and the details injection was removed from the other events.

We are using a tweaked version of the custom single-espresso_events.php template for this hidden password protected event.


Joao Victor

  • Support Staff

July 13, 2022 at 1:27 pm

Hi there!

Thanks for getting back to us.

I would like to check your custom template file and run a couple of tests from that. Could you please upload your file and share it with me as a private reply?


bakerrisk

July 13, 2022 at 1:59 pm

This reply has been marked as private.
Viewing 5 reply threads

The support post ‘How to stop the_content injection when using custom template?’ 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