This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

How to customize the content area of a 404 page

  • Creator
    Topic
  • #9684
    shorthills
    Participant

    Hi,
    What’s the procedure to customize the 404 page? I was going to copy it to my child theme and do my thing, but I looked at 404.php and there were warnings not to touch it.

    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #9685
    Jason Bobich
    Keymaster

    Hello,

    The better approach is to copy content-404.php to your Child theme. This will be a much more simple file to edit, where you’re just editing the content area of the 404 page. This will also give you less risk of encountering issues with updates in the future, as often the overall structure in the main template files like 404.php, page.php, etc, changes.

    More info on this topic:

    http://dev.themeblvd.com/tutorial/editable-content-files/

    #9699
    shorthills
    Participant

    Awesome! Thanks.

    #13994
    Kjetil
    Participant

    Hi
    This works fine for mistyped url’s (like http://www.dolcevita.no/toscanax), but not if somebody performs a search which doesn’t return anything (like http://www.dolcevita.no/?s=toscanax). Is there a way to make the custom (child theme’s) content-404.php appear there too?
    Thanks,
    Kjetil
    (I mainly use Alyeska, but I guess its just the same setup)

    #13995
    Jason Bobich
    Keymaster

    @Kjetil This is what the content-search.php template file is used for, which is called from within the template file search.php. So, content-search.php is the theme’s specific template part file for when a search brings back no results. You can edit that template part if you like.

    You could also filter themeblvd_template_parts to call content-404.php if you really wanted. —

    function my_template_parts( $parts ) {
        $parts['search'] = '404';
        return $parts;
    }
    add_filter( 'themeblvd_template_parts', 'my_template_parts' );

    However, WordPress does not work by calling the main 404.php when a search brings back no results. Whether there are results or not, WordPress always triggers search.php. So, it wouldn’t really make sense for theme to call the 404 template part (i.e. content-404.php), as that’s not what it is.

    #13996
    Kjetil
    Participant

    Beautiful !
    Editing a copy of the content-404.php file (in the child theme folder) worked just as I hoped.
    Thanks

    #16098
    inetinitiatives
    Participant

    Hi Jason,

    Is there any way to easily customize a 404 page for a site which ISN’T using a child theme? For smaller sites in which the Custom CSS dialog and the standard theme options are sufficient for example…

    Also, where exactly would the customized text, etc. go within the code that is in the content-404.php file?

    #16102
    Jason Bobich
    Keymaster

    Hello,

    I believe you can customize the 404 page text from our String Swap plugin. This is the only way I can think of without PHP customization.

    http://wordpress.org/plugins/theme-blvd-string-swap/

    #16113
    inetinitiatives
    Participant

    Thanks much, I’ll give that a try.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The forum ‘The Arcadian Responsive WordPress Theme’ is closed to new topics and replies.