Skip to content

Instantly share code, notes, and snippets.

@aleohl
Created February 22, 2022 18:02
Show Gist options
  • Save aleohl/3b0d139b3bd319c80b83428de351340a to your computer and use it in GitHub Desktop.
Save aleohl/3b0d139b3bd319c80b83428de351340a to your computer and use it in GitHub Desktop.
#avada
/**
* Re-add the third party changes of the_content filter.
*
* @access public
* @since 2.2
* @param object|bool $override The override or false.
* @return void
*/
public function readd_third_party_the_content_changes( $override = false ) {
global $avada_events_calender;
if ( class_exists( 'Tribe__Events__Main' ) ) {
add_filter( 'the_content', [ $avada_events_calender, 'single_events_blocks_sharing_box' ], 10 );
}
do_action( 'awb_readd_third_party_the_content_changes' );
remove_filter( 'dpsp_is_location_displayable', '__return_false' );
if ( defined( 'TUTOR_VERSION' ) ) {
remove_filter( 'tutor_dashboard_page_id', '__return_false' );
remove_filter( 'instructor_register_page', '__return_false' );
remove_filter( 'student_register_page', '__return_false' );
}
if ( class_exists( 'Cooked_Plugin' ) ) {
global $_cooked_content_unfiltered;
$_cooked_content_unfiltered = false;
}
if ( isset( $GLOBALS['is_pc_bundle'] ) && $GLOBALS['is_pc_bundle'] ) {
add_filter( 'the_content', 'pc_perform_contents_restriction', 999 );
}
if ( is_singular( 'dwqa-question' ) ) {
global $dwqa;
$dwqa->template->remove_all_filters( 'the_content' );
}
if ( $override ) {
if ( defined( 'WP_SHARING_PLUGIN_VERSION' ) ) {
add_filter( 'the_content', 'sharing_display', 19 );
}
if ( class_exists( 'SFWD_LMS' ) ) {
SFWD_LMS::content_filter_control( true );
}
// Ultimate Member.
remove_filter( 'um_ignore_restricted_content', '__return_true' );
// WooCommerce Membership.
if ( function_exists( 'wc_memberships' ) ) {
add_filter( 'the_content', [ wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance(), 'handle_restricted_post_content_filtering' ], 999 );
}
if ( function_exists( 'members_content_permissions_protect' ) ) {
add_filter( 'the_content', 'members_content_permissions_protect', 95 );
}
if ( defined( 'MEPR_PLUGIN_NAME' ) ) {
add_filter( 'the_content', 'MeprAppCtrl::page_route', 100 );
add_filter( 'the_content', 'MeprGroupsCtrl::render_pricing_boxes', 10 );
add_filter( 'the_content', 'MeprProductsCtrl::display_registration_form', 10 );
add_filter( 'the_content', 'MeprRulesCtrl::rule_content', 999999, 1 );
}
if ( class_exists( 'WordPressDownloadManager' ) ) {
add_filter( 'the_content', 'wpdm_downloadable' );
}
}
if ( class_exists( 'EM_Event_Post' ) ) {
add_filter( 'the_content', [ 'EM_Event_Post', 'the_content' ] );
}
if ( class_exists( 'bbPress' ) && Fusion_Helper::is_bbpress() && ! Fusion_Helper::is_buddypress() && ! bbp_is_template_included() && bbp_is_theme_compat_active() ) {
bbp_remove_all_filters( 'the_content' );
}
if ( function_exists( 'tve_leads_get_default_form_types' ) ) {
foreach ( tve_leads_get_default_form_types() as $_type => $config ) {
if ( ! isset( $GLOBALS['tve_lead_forms'][ $_type ] ) || ( 'widget' !== $_type && 'php_insert' !== $_type && empty( $config['wp_hook'] ) ) ) {
continue;
}
if ( isset( $config['wp_hook'] ) ) {
add_action( $config['wp_hook'], 'tve_leads_display_form_' . $_type, isset( $config['priority'] ) ? $config['priority'] : 10 );
}
}
}
// WP Customer Area plugin.
if ( class_exists( 'CUAR_CustomerPagesAddOn' ) && function_exists( 'cuar_addon' ) ) {
$cp_addon = cuar_addon( 'customer-pages' );
add_filter( 'the_content', [ $cp_addon, 'define_main_content_filter' ], 9998 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment