Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active October 24, 2016 16:20
Show Gist options
  • Save srikat/3e93305292b7951bcd8c to your computer and use it in GitHub Desktop.
Save srikat/3e93305292b7951bcd8c to your computer and use it in GitHub Desktop.
Full Width Page Template in Genesis for Beaver Builder. https://sridharkatakam.com/full-width-page-template-in-genesis-for-beaver-builder/
/**
* Template Redirect
* Use page_beaver.php for all static Pages.
*/
add_filter( 'template_include', 'custom_page_template', 99 );
function custom_page_template( $template ) {
if ( is_singular( 'page' ) ) {
$new_template = locate_template( array( 'page_beaver.php' ) );
if ( '' != $new_template ) {
return $new_template ;
}
}
return $template;
}
<?php
// Template Name: Full Width Page
add_filter( 'body_class', 'beaver_body_class' );
/**
* Adds a css class to the body element
*
* @param array $classes the current body classes
* @return array $classes modified classes
*/
function beaver_body_class( $classes ) {
$classes[] = 'fl-builder-full';
return $classes;
}
/**
* Add attributes for site-inner element, since we're removing 'content'.
*
* @param array $attributes Existing attributes.
* @return array Amended attributes.
*/
function be_site_inner_attr( $attributes ) {
// Add the attributes from .entry, since this replaces the main entry
$attributes = wp_parse_args( $attributes, genesis_attributes_entry( array() ) );
return $attributes;
}
add_filter( 'genesis_attr_site-inner', 'be_site_inner_attr' );
// Display Header
get_header();
// Display Content
the_post(); // sets the 'in the loop' property to true.
the_content();
// Display Comments
genesis_get_comments_template();
// Display Footer
get_footer();
/* Full Width Page
-------------------------------------------- */
.fl-builder-full .site-inner {
max-width: none;
padding-top: 0;
}
@media only screen and (max-width: 800px) {
.fl-builder-full .site-inner {
padding-left: 0;
padding-right: 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment