Lego2012
12/13/2016 - 6:06 PM

Apply layouts conditionally

Apply layouts conditionally

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

<!-- Apply full width layout to homepage -->

add_action( 'get_header', 'sk_force_layout' );
function sk_force_layout() {

    if (is_home() || is_front_page()) {
        add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
    }

}

<!-- Apply Sidebar Content layout to a CPT’s single entries -->

add_action( 'get_header', 'sk_force_layout' );
function sk_force_layout() {

    if ( is_singular('testimonial' ) ) {
        add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_sidebar_content' );
    }

}