Site logo

Archived topic

Custom Error Page 404 (clickable links)

22 replies · Started by Siong Boon Lim on January 31, 2016

Viewing posts 1–15 of 23

Hi Tom,

I would like to customise the error 404.
I have learn about changing the text on the page 404 using the filter.
https://generatepress.com/forums/topic/change-the-text-404-error/#post-115744

May I know how can I add more text with clickable links, before and after the default appearing search bar? I am also interested to add a icon/graphic to this error page (page not found).

Thank you.

Thank you.
I used this plugin. Easy to use.
Just that, The search bar is no longer around.
Wonder if it is possible to have it back for the "page not found" page.

Hi Tom,

I have come across the following page after using the search bar.
{
Nothing Found
Sorry, but nothing matched your search terms. Please try again with some different keywords.
}

I was then I realise it is different from 404page.
My intention was also to have a custom page to guide the guest when they couldn't find what they want in the website.

Would need your advise on this.
Thank you.

Ah yea, that's the no results page.

You can ask the plugin developer if they have an option for that - if not, I'll see if I can come up with something :)

If I only want to customise the text, and have clickable links,
will the simple hook works?

Looks like I need to add some filters to the no-results.php template.

Are you using a child theme? If so, copy the no-results.php template from the generatepress folder and add it to your child theme. Then you can change the content as needed :)

Yes. I am using a child Theme.
Thank you for your advise.

Hi Tom,

I am able to customise the "Nothing Found" page.
How do I disable the sidebar?
The sidebar is not showing relevant content and I do not want to show it.

The page uses the is_search() conditional, so removing the sidebar would also remove it from search result pages.

Would that be ok?

Hi Tom,

I don't understand.
How is "is_search()" related to the sidebar?

We can disable sidebars, but we need to be able to pick the page where we disable it.

In this case, the only way to target that specific template to remove the sidebar is to use is_search() which is used by all search results.

I've researched it quite heavily and there doesn't seem to be a way to only target the no results page.

add_filter( 'generate_sidebar_layout','generate_custom_search_sidebar_layout' );
function generate_custom_search_sidebar_layout( $layout )
{
 	if ( is_search() )
 	 	return 'no-sidebar';

 	return $layout;

 }

Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

Hi Tom,

I do not want to use plugin for small thing. Can you provide filter that will redirect to custom 404 page.

Let me know :)

Thanks.

There isn't a filter built-in to the theme for this.

We'd definitely provided that solution if there was :)

This archived topic is closed to new replies.