Updated on May 04, 2018
In the past, I shared a page template for Beaver Builder based on Bill Erickson’s full width landing pages here.
Here I cover a similar but slightly better/generic approach that can be used for Beaver Builder, Elementor and theoretically, any other page builder (I have only tested those two) in Genesis.
While the tutorial has been written for Genesis Sample 2.6.0, it should work with a few adjustments in any Genesis theme.
Step 1
Create a file named say, template-full.php
in the child theme directory having the following:
<?php
// Template Name: Full Width
add_filter( 'genesis_attr_site-inner', 'be_site_inner_attr' );
/**
* Adds the attributes from 'entry', since this replaces the main entry.
*
* @author Bill Erickson
* @link http://www.billerickson.net/full-width-landing-pages-in-genesis/
*
* @param array $attributes Existing attributes.
* @return array Amended attributes.
*/
function be_site_inner_attr( $attributes ) {
// Adds a class of 'full' for styling this .site-inner differently
$attributes['class'] .= ' full';
// Adds an id of 'genesis-content' for accessible skip links
$attributes['id'] = 'genesis-content';
// Adds the attributes from .entry, since this replaces the main entry
$attributes = wp_parse_args( $attributes, genesis_attributes_entry( array() ) );
return $attributes;
}
// Displays Header.
get_header();
genesis_do_breadcrumbs();
// Displays Content.
the_post(); // sets the 'in the loop' property to true. Needed for Beaver Builder but not Elementor.
the_content();
// Displays Comments (if any are already present and if comments are enabled in Genesis settings - disabled by default for Pages).
genesis_get_comments_template();
// Displays Footer.
get_footer();
Step 2
On inner Pages where you want to use the page builder, apply Full Width
template.
and build your Page(s).
Step 3
To use a page builder on your site’s homepage,
a) Create a Page titled say, Home
, select Full Width
template and Publish.
b) At Settings > Reading, set Home
as the static homepage.
c) [optional] You may want to create a Page titled say, Blog
or News
and set it as the Posts page.
d) Create a file named front-page.php
in the child theme directory having:
<?php
get_template_part( 'template', 'full' );
Step 4
Add the following in child theme’s style.css:
/* Full Width Page
-------------------------------------------- */
.site-inner.full {
max-width: none;
padding: 0;
}
Note: If you want to use the page builder on all the Pages of your site, create a file named page.php
having the code from step 3d.
This worked beautifully for me using Digital Pro 1.1.2 from StudioPress until I got to front-page.php. Then it just gave me a blank page. I had to paste everything from the template except for the template name right into front-page.php for it to work. I also tried adding the Genesis loop at the bottom of front-page.php, and that did give me the content, but without the full width formatting–it seemed to ignore that completely.
Is it possible that get_template_part doesn’t work with all themes?
Thank you!
Hey Sridhar. Found a bug. In your template code you have ‘ full’ as the class instead of ‘full’. It’s an extra space.
That extra space is needed or otherwise, the div will get a class of
site-innerfull
.What we are aiming for is
site-inner full
.Screenshot:
Hmmm when I tried your code on Genesis Sample Master from here with that code it didn’t work. Removed the space and it worked…
oh ok. I might have made some changes in that theme which could be causing this.
Unless otherwise specified, all the code I test and write is in the standard Genesis Sample.
This is great! Is there anyway to keep a left sidebar in there? So the sidebar is all the way on the left and the rest of the page is full width. I’m picturing the sidebar as 360 px or so until responsive. Any thoughts?
Hey Sridhar (and Bill):
Thank you for your contributions to the community.
I employed the solution above, and confirm it remains stable for GS 2.6.1 on front-page.php and page.php. I experimented with incorporating this on single.php in GS , adding the following:
// This file handles single entries, but only exists for the sake of child theme forward compatibility.
genesis();
get_template_part( ‘template’, ‘full’ );
Unfortunately, this approach was not successful.
Thoughts on an appropriate solution?
Thanks again for your insights.
Hey Johnny,
This benefit of the solution in this article is that it does not call
genesis()
.If you need to, then this template is not to be used.
What exactly are you trying to do?
Hey Sridhar:
I attempted to apply your solution to posts as well. I thought if I include the single.php in the child theme it may create full width templates for the posts as well. Unfortunately, I was not successful.
I believe I experimented without genesis(); as well by only including the code in Step 3D above, but I was unsuccessful there as well.
Thoughts?
Which child theme are you using?
Genesis Sample, but only because your solution above was for that child theme.
I have access to the Genesis child theme repository, so it could be any recently-updated one.
Thank you for your insights.
Just tested the following and it’s working fine on single posts in Genesis Sample 2.6.0.
single-post.php:
Added in style.css:
Hey Sridhar:
I was able to test your solution above for single posts, and works perfectly. I added some custom CSS to address the comments going full-width and it is a great solution.
I have made a modest donation; thanks again for your insights.
One additional question, if you have a moment: How would we apply this solution to archive pages, whether the blog page or categories?
I tried Dalton’s full-width solution, but that didn’t execute.
Thoughts?
Thanks again.
I have not checked my PayPal account yet but thanks for the donation.
Which layout do your archives and single blog posts use? content-sidebar or full content?
That contribution is headed to your PP via rb.
I have incorporated your suggestion above for single-post.php, and that executed full vw.
The archive pages—example.com/blog/—use full content (no sidebar), again in Gen Sample 2.6.1 (does the Genesis theme matter that much?), but no dice.
I created page_blog.php in the child theme, removed the call genesis(); and then input the full width arg in Step 3D above, this doesn’t work. And the page_archive.php produces a “sitemap-esque” page rather than a typical blog or category page.
Thoughts?
Thanks dude.
May I know what
rb
is?Coming to the issue at hand, let’s tackle 1 at a time. We’ll begin with the Posts page and archives. For these, it is not recommended to use the template in this tutorial because you are not going to use a page builder on them.
Do you want the actual content width to be 100vw (perhaps w/ some padding) on these?
Hey Sridhar:
Thanks for the reply.
rb are the initials of the pal who forwarded the contribution on my behalf.
I am looking for 100vw, correct, with margin: 0px 0px 0px 0 px and padding (around): 40px 40px 40px 40px.
By “Posts” page, do you mean the blog page?
I may run a 30-day trial on the beaver themer to see whether there it has value-added since I am not a Genesis expert (and I may not be able to CSS my way through the layout I have in mind even with 100vw in place).
Thoughts?
Yes.
Add the following in Genesis Sample’s
functions.php
:and add this in its
style.css
:[…] the past, I wrote a tutorial on full-width pages ripe for use with page builders like Beaver Builder and Elementor. While that […]
Excellent!
Working also for Page Builder by SiteOrigin but without step 4.
Thank you.