Archived topic
Sorry, bit of an simple one... how to change the 404 Layout?
6 replies · Started by Henry on July 31, 2020
Changing the text is easy, I used a snippet I found here:
add_filter( 'generate_404_title','generate_custom_404_title' );
function generate_custom_404_title()
{
return 'Custom Text';
}
add_filter( 'generate_404_text','generate_custom_404_text' );
function generate_custom_404_text()
{
return 'Custom Text';
}
However, what about the actual layout? Do we just edit the 404.php file and place in child theme?
Hi there,
yes the best method is to create your own 404.php template in your Child Theme.
In GP 3.0 will be making it easier to do this without a Child Theme.
OK, thanks.
Will GP 3.0 also allow to create templates (layouts) for archive posts and other nested content like tag archive pages?
Also - regarding the custom PHP page:
I am trying to hide the sidebar and I thought that I would be able to
So, at the bottom of the script (404 template) there is this line which if I comment out removes the sidebar - just want to make sure that that's the best approach to remove the sidebar?
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();
//generate_construct_sidebars();
I tried it and it works (i.e. removes sidebar) but want to make sure I did it correctly - thanks
Will GP 3.0 also allow to create templates (layouts) for archive posts and other nested content like tag archive pages?
Not yet but it's in the plan.
And the sidebar removal should work. The other option is to use a layout element.
Thanks - yes of course, much easier > elements > layout > 404 display....
No problem :)