Archived topic
Customizing 404 page
15 replies · Started by mkjj on August 17, 2020
We would like to customize the 404 page. This is pretty easy by copying it to the child theme folder. I removed the sidebar and changed the page to a boxed layout. While this is pretty straightforward, some not so clean workarounds are needed. For example, the classes for the "primary" DIV are generated dynamically. So, I have to hardcode the classes.
Can I customize the page using the out-of-the-box theme tools? As far as I understand, there is no customizer setting for the 404 page. So, I can't set the layout options for this page, can I?
Don't get me wrong. I'm ok with that. Just would like to know if a better solution exists.
Thanks.
Hi there,
currently there is now way to directly edit the 404 template from within the theme.
But we are working on something that will allow that and a lot more in the next free theme and plugin updates.
However you can still use Elements for the 404. It has its own display rule:
https://docs.generatepress.com/article/elements-overview/
Oh and the new Block Element also applies:
https://docs.generatepress.com/article/block-element-overview/
Thanks for the lightning fast support. The element pretty much does the trick. Very neat and powerful feature. Nice work! Doing it this way, I don't need a customized file in the child theme.
You're welcome - glad to hear that worked for you
How do you create/edit 404 page?
A plugin like this should work the best:
https://wordpress.org/plugins/404page/
Thanks... have installed the plugin and selected page to be displayed as 404 page. How do I add header image (page hero)? I already have some images for other pages, however if I add 404 custom page to the list of locations (display rules - in elements), I don't see the image.
Can you open a new topic for your question?
THanks!
Any ETA on..
""But we are working on something that will allow that and a lot more in the next free theme and plugin updates."""
So you will be able to edit the 404 page?
Hi there,
you can already using the Block Element (or Hook Element).
See here for how to:
https://generatepress.com/forums/topic/how-to-redirect-404-error-to-custom-page/#post-1542136
Awesome, thanks @David
Does this work in a child theme only? For test purposes I'v just tried it without a child theme, and it still does not show the content of the the new block element.
As long as your using GP theme 3.0 then that hook will work. It doesn't require a child theme.
Ah, sorry, I was running an outdated version of GP Premium. I've just updated, and now it is working fine.
Thanks.
Awesome feature, by the way!