Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page builder check for shortcodes in admin #3327

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5038,3 +5038,54 @@ function pmpro_display_member_account_level_message( $level ) {
}
}
add_action( 'pmpro_membership_account_after_level_card_content', 'pmpro_display_member_account_level_message' );

/**
* Check if the current page is being edited with a page builder.
*
* @return bool True if the page is being edited with a page builder, false otherwise.
*/
function pmpro_is_page_builder_editor() {

// Check that we are editing a post.
global $post;
if ( ! $post ) {
return false;
}

// Check for Elementor.
if ( did_action( 'elementor/loaded' ) && isset( $_GET['elementor-preview'] ) ) {
return 'Elementor';
}

// Check for Visual Composer
if ( function_exists( 'vchelper' ) ) {
$frontendHelper = vchelper('Frontend');
if ( $frontendHelper->isVcvFrontend() ) {
return 'Visual Composer';
}
}

// Check for Beaver Builder, they even use the 'fl_builder' param as their check method.
if ( class_exists( 'FLBuilderModel' ) && isset( $_GET['fl_builder'] ) ) {
return 'Beaver Builder';
}

// Check for Divi Builder.
if ( function_exists( 'et_fb_is_enabled' ) && et_core_is_fb_enabled() ) {
return 'Divi';
}

// Check for Fusion Builder (Avada).
if ( ( function_exists( 'fusion_is_preview_frame' ) && fusion_is_preview_frame() ) || ( function_exists( 'fusion_is_builder_frame' ) && fusion_is_builder_frame() ) ) {
return 'Fusion';
}

// Check for Bricks Builder.
if ( function_exists( 'bricks_is_builder' ) && bricks_is_builder() ) {
return 'Bricks';
}


return false;

}
7 changes: 5 additions & 2 deletions includes/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ function pmpro_wp()
{
if( ! empty( $post->post_content ) && ( strpos( $post->post_content, "[pmpro_" . $pmpro_page_name . "]" ) !== false || ( function_exists( 'has_block' ) && has_block( 'pmpro/' . $pmpro_page_name . '-page', $post ) ) ) )
{
//preheader
require_once(PMPRO_DIR . "/preheaders/" . $pmpro_page_name . ".php");
// Do not load preheader if we are in the builder because of the redirects they do causing issues.
$editor = pmpro_is_page_builder_editor();
if ( ! $editor ) {
require_once(PMPRO_DIR . "/preheaders/" . $pmpro_page_name . ".php");
}

//add class to body
$pmpro_body_classes[] = "pmpro-" . str_replace("_", "-", $pmpro_page_name);
Expand Down