Custom Error Page 404 (clickable links)

Home Forums Support Custom Error Page 404 (clickable links)

Home Forums Support Custom Error Page 404 (clickable links)

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #169472
    Siong Boon Lim

    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.

    • This topic was modified 8 years, 2 months ago by Siong Boon Lim.
    #169496
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You can do this by using filters, but it may be easier to do using this plugin: https://wordpress.org/plugins/404page/

    Let me know.

    #169506
    Siong Boon Lim

    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.

    #169631
    Tom
    Lead Developer
    Lead Developer
    #170570
    Siong Boon Lim

    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.

    #170675
    Tom
    Lead Developer
    Lead Developer

    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 πŸ™‚

    #170803
    Siong Boon Lim

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

    #170839
    Tom
    Lead Developer
    Lead Developer

    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 πŸ™‚

    #170851
    Siong Boon Lim

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

    #170864
    Siong Boon Lim

    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.

    #170997
    Tom
    Lead Developer
    Lead Developer

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

    Would that be ok?

    #171016
    Siong Boon Lim

    Hi Tom,

    I don’t understand.
    How is “is_search()” related to the sidebar?

    #171031
    Tom
    Lead Developer
    Lead Developer

    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/

    #898452
    Somnath

    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.

    #898472
    Leo
    Staff
    Customer Support

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

    We’d definitely provided that solution if there was πŸ™‚

Viewing 15 posts - 1 through 15 (of 23 total)
  • You must be logged in to reply to this topic.