How to make Posts page obey its Page layout setting in Genesis

Posted on

In Genesis Page specific layouts override the default layout from theme settings. But the same does not apply for the Page set as Posts page (in Settings > Reading). Regardless of what layout you select when editing this Page, the default layout will continue to be used unless the following code is added in the child theme’s functions.php:

/**
 * Make Posts page obey its Page layout setting
 */
add_filter( 'genesis_pre_get_option_site_layout', 'sk_do_posts_page_layout' );
function sk_do_posts_page_layout( $opt ) {

	if ( ! is_home() ) {
		return;
	}

	$opt = get_post_meta( get_option( 'page_for_posts' ), '_genesis_layout', true );

	return $opt;

}