Archived topic
404 Page title error
7 replies · Started by Sterk Digital on October 23, 2021
Hi,
I was having an issue with my 404 page showing the title of my latest posts.
So in order to resolve this issue I excluded my 404 page from the Block - Page Hero and that stops the title from showing.
But now there is no space anymore between the logo of the site and the 404 error message.
How do i insert a header or add some space to my 404 page so that there is space between my site logo and the title of the 404 page?
Hi there,
you can create a Hero Element specifically for your 404 page, by setting the Display Rules Location to: 404 Template.
Hi,
I have done this, but it is not showing up on the 404 page.
Also.. How do I edit the contents of the 404 page?
I have created temp access for you an included this in the Private information so you can have a look.
Thanks.
Hi there,
You can try creating a Block Element - Content Template and set the display rule location to your 404 page like this - https://share.getcloudapp.com/wbu8mGRG
Ok, thanks that is working.
Another question, how do I change the title of the page? So not the H1 title, but the meta title.
It now shows Page Not Found - Same of the site and I would like to edit this.
Thanks
You'll need a SEO Plugin like Yoast or a PHP snippet for that.
Example:
add_filter( 'document_title_parts', 'page_404_title_change', 15,1 );
function page_404_title_change( $title ){
if ( is_404() ) {
$title_parts_array['title'] = 'ADD 404 TITLE TEXT HERE';
}
return $title_parts_array;
}
Here's how to add PHP snippets to the site - https://docs.generatepress.com/article/adding-php/
Thanks,
Got it all working.
Nice one. No problem. :D