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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); | |
} |
Thank you, it does exactly what is needed!
[…] you can see from the image above, my 404 page is now full width. Thanks to Sridhar Katakam for providing the code to help me do […]
i used your code to make my 404 page full-width but how do I get rid of the ‘max-width’ property that is preventing it from being truly full-width?
Is there a way to remove the max-width from the page? I have a ‘div’ that I would like to stretch the entire width of the page.
Can you provide the URL of your site?
here’s an example of an error page…
https://goodmanspeakers.com/404
Add this CSS:
that worked perfectly. thank you so much!