Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active November 16, 2022 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/bb0c36c05392a3b91ea1c635fcaa794d to your computer and use it in GitHub Desktop.
Save Pebblo/bb0c36c05392a3b91ea1c635fcaa794d to your computer and use it in GitHub Desktop.
Example of how to remove/re-add EE's filter on the_content when using Avada.
<?php // Do not include the opening PHP tag if you already have one.
add_action('awb_remove_third_party_the_content_changes', 'tw_ee_avada_remove_filters', 10);
function tw_ee_avada_remove_filters() {
remove_filter(
'the_content',
array('EED_Event_Single', 'event_details'),
EED_Event_Single::EVENT_DETAILS_PRIORITY
);
remove_filter(
'the_content',
array('EED_Events_Archive', 'event_details'),
EED_Events_Archive::EVENT_DETAILS_PRIORITY
);
}
add_action('awb_readd_third_party_the_content_changes', 'tw_ee_avada_readd_filters', 20);
function tw_ee_avada_readd_filters() {
if (
is_single() &&
'espresso_events' == get_post_type()
) {
add_filter(
'the_content',
array('EED_Event_Single', 'event_details'),
EED_Event_Single::EVENT_DETAILS_PRIORITY
);
}
if(is_post_type_archive('espresso_events')) {
add_filter(
'the_content',
array('EED_Events_Archive', 'event_details'),
EED_Events_Archive::EVENT_DETAILS_PRIORITY
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment