Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active February 4, 2016 03:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srikat/23d61e1f064f7bf7e1e7 to your computer and use it in GitHub Desktop.
Save srikat/23d61e1f064f7bf7e1e7 to your computer and use it in GitHub Desktop.
Front Page Template for Full Width Sections in Genesis. https://sridharkatakam.com/front-page-template-for-full-width-sections-in-genesis/
<?php
add_filter( 'genesis_attr_site-inner', 'sk_attributes_site_inner' );
/**
* Add attributes for site-inner element.
*
* @since 2.0.0
*
* @param array $attributes Existing attributes.
*
* @return array Amended attributes.
*/
function sk_attributes_site_inner( $attributes ) {
$attributes['role'] = 'main';
$attributes['itemprop'] = 'mainContentOfPage';
return $attributes;
}
// Remove div.site-inner's div.wrap
add_filter( 'genesis_structural_wrap-site-inner', '__return_empty_string' );
// Display header
get_header();
// Content
echo 'Hello World';
// Display Footer
get_footer();
// Register widget areas
genesis_register_sidebar( array(
'id' => 'home-featured',
'name' => __( 'Home Featured', 'themename' ),
'description' => __( 'This is the homepage featured section', 'themename' ),
));
genesis_register_sidebar( array(
'id' => 'home-strap-text',
'name' => __( 'Home Strap Text', 'themename' ),
'description' => __( 'This is the home strap text section.', 'themename' ),
));
<?php
add_filter( 'genesis_attr_site-inner', 'sk_attributes_site_inner' );
/**
* Add attributes for site-inner element.
*
* @since 2.0.0
*
* @param array $attributes Existing attributes.
*
* @return array Amended attributes.
*/
function sk_attributes_site_inner( $attributes ) {
$attributes['role'] = 'main';
$attributes['itemprop'] = 'mainContentOfPage';
return $attributes;
}
// Remove div.site-inner's div.wrap
add_filter( 'genesis_structural_wrap-site-inner', '__return_empty_string' );
// Display header
get_header();
// Content
// Display Home Featured widget area
genesis_widget_area( 'home-featured', array(
'before' => '<div class="home-featured widget-area">',
'after' => '</div>',
));
// Display Home Strap Text widget area
genesis_widget_area( 'home-strap-text', array(
'before' => '<div class="home-strap-text widget-area"><div class="wrap"',
'after' => '</div></div>',
));
// Display Footer
get_footer();
/* Front Page Template for Full Width Sections
-------------------------------------------- */
.home .site-inner {
max-width: none;
padding-top: 0;
}
.home .site-inner .widget-area {
padding: 40px 0;
}
.home .site-inner .home-featured {
padding: 0;
}
.home-featured .soliloquy-container {
margin-bottom: 0 !important;
}
.soliloquy-container .wrap {
margin: 0 auto;
padding: 40px;
line-height: 1.3;
}
.home-strap-text {
text-align: center;
}
.home-strap-text .button {
margin-top: 20px;
}
/* Front Page Template for Full Width Sections
-------------------------------------------- */
.home .site-inner {
max-width: none;
padding-top: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment