How to set full width content on 404 pages in Genesis

Posted on

If you would like to force full width content for 404 Page Not Found error pages in Genesis and not have it use the default layout set in theme settings, add the following in child theme’s functions.php:

add_action( 'get_header', 'sk_set_404_layout' );
/**
 * Force full width content on 404 pages
 *
 * @author Sridhar Katakam
 * @link   https://sridharkatakam.com/how-to-set-full-width-content-on-404-pages-in-genesis/
 */
function sk_set_404_layout() {
	if ( ! is_404() ) {
		return;
	}

	add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}