How to use your own landing page while using header and footer in Genesis Framework

Tag: |   Category:

To use your own landing page so that you can control the width of your page while still have Genesis default header and footer use below code.

Genesis default framework looks like this (/genesis/lib/framework.php)

Create a page and paste below code


<?php
/**
* Template Name: YOUR TEMPLATE NAME
*/

function be_site_inner_attr( $attributes ) {

// Add a class of 'full' for styling this .site-inner differently
$attributes['class'] .= ' full';

// 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' );
remove_filter( 'genesis_attr_site-inner', 'be_site_inner_attr' );
// Build the page
get_header();
echo '
<div class="main_body_class_inner">';
do_action( 'genesis_loop' );
echo '</div>

';
get_footer();

You can style you style.css as below

.main_body_class_inner        {
max-width:600px;
margin:0 auto;
}

Thanks to billerickson for the idea.

Copyright © 2024 Siam Naulak.
magnifiercrossmenu