Code to Change Page Layout Using Genesis Framework

If you want to change the page layout for specific sites, you can use this code:

/** Force full width layout on single posts only*/
add_filter( 'genesis_pre_get_option_site_layout', 'customize_site_layout' );

function customize_site_layout( $opt ) {
    global $post; 

    if ( is_page(292) || ($post->post_parent == 292) ) {
        $opt = 'sidebar-content'; 
    } 

    return $opt;
}

This code changes the default page layout for the site with ID 292 and the child pages of the site with ID 292.

Possible layouts are:

  • content-sidebar
  • sidebar-content
  • content-sidebar-sidebar
  • sidebar-sidebar-content
  • sidebar-content-sidebar
  • full-width-content