Last active
September 23, 2018 16:51
-
-
Save paullacey78/70793565dd840a330a261664eca41d61 to your computer and use it in GitHub Desktop.
Force GP into full width, hide page header & title and force layout to no sidebar with Beaver Builder is active on a page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* PAGE HEADER */ | |
/* Hide the page header when BB is active on a page */ | |
.hide-page-header .generate-page-header, | |
.hide-page-header .page-header-image, | |
.hide-page-header .page-header-image-single { | |
display:none; | |
} | |
/* Unhide the page header when BB is active but we want to use GP custom page header */ | |
.hide-page-header .generate-page-header.page-header-content, | |
.hide-page-header .page-header-image.page-header-content, | |
.hide-page-header .page-header-image-single.page-header-content { | |
display:block; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* GENERATEPRESS & BEAVER BUILDER SETUP */ | |
/* Automatically activate full width, hide title, and set no sidebar | |
layout in GeneratePress if Beaver Builder is installed and enabled */ | |
/** full width & hide page header unless custom header is enabled in GeneratePress **/ | |
add_filter( 'body_class', 'plm_custom_body_class' ); | |
function plm_custom_body_class( $classes ) { | |
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) { | |
$classes[] = 'full-width-content'; | |
$classes[] = 'hide-page-header'; | |
return $classes; | |
} | |
else { | |
return $classes; | |
} | |
} | |
/** remove page title from actual html **/ | |
add_filter( 'generate_show_title', 'plm_remove_page_title', 20 ); | |
function plm_remove_page_title($output) { | |
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) { | |
return false; | |
} | |
else { | |
return $output; | |
} | |
} | |
/** Set page layout to no sidebar **/ | |
add_filter( 'generate_sidebar_layout','plm_custom_sidebar_layout' ); | |
function plm_custom_sidebar_layout( $layout ) { | |
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled() ) { | |
return 'no-sidebar'; | |
} | |
else { | |
return $layout; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment