Want to set Full Content layout for Blog, Archives and Posts page in Genesis with other pages of the site having a Content Sidebar layout?
Go to theme settings and set Content Sidebar layout as the default.
Then add the following in child theme’s functions.php:
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
// Apply Full Width Content layout to Posts page, Single Posts and Archives. | |
add_action( 'get_header', 'sk_set_full_layout' ); | |
function sk_set_full_layout() { | |
if ( ! ( is_home() || is_singular( 'post' ) || is_archive() ) ) { | |
return; | |
} | |
// Force full width content | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
} |
Hello Sridhar,
I’m a new follower, and new to Genesis (but not WP.) I’m wondering why one would do this instead of selecting the layout when making a post or blog page. Is it to avoid the trouble of doing so every time, especially for a client who may forget? Are there other advantages?
jean roth
Yes.
Also layout set to a Page set as Posts page will not take effect.
Remember: http://www.billerickson.net/dont-use-genesis-blog-template/
Thank you. The Bill Erickson link doesn’t work (site seems to be gone), but that looks like something I’d like to read as a new Genesis user.
Whoops, it appears to be back! 🙂
Hi Sridhar, Do you have a post that shows how to do the reverse of this? My site is full-width, but I’d like the blog page, single posts, and archives to have a sidebar.
Hi Carrie,
In the above code simply replace
__genesis_return_full_width_content
with__genesis_return_content_sidebar
.Thanks!
Thanks for this!
Thank you!! I have struggled with this for a while.