To edit your Theme’s 404 error template file:
- Open your WordPress admin panel:
- Choose Appearance menu.
- Choose the Theme Editor page.
- Check to see if your theme includes a ‘404 Template’ in the list of files.
- Click the link for ‘404 Template’ along the right side of the page.
- Edit the message text to say what you want it to say.
- Save your changes.
The default 404.php file will look like this:
<?php get_header(); ?> <div id="content"> <h2>Error 404 - Not Found</h2> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
The default 404.php file will provide the user with your sites basic navigation. Within the <div></div> you will see an <h2>. You can change this text or leave it the same. You should definitely add some additional text after the <h2> and provide some links to different areas of your site that they may have been looking for. They should be able to get to these areas via your navigation but by highlighting them on your 404 page you eliminate the need for the user to hunt through your navigation.
If all you want to add is some text and a link here is a quick example.
<?php get_header(); ?> <div id="content"> <h2>Error 404 - Not Found</h2> <p>This is an example of code for a 404 page. If you would like to go to Google click the link below.</p> <a href="http//google.com">Click Here</a> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
<p> Denotes a paragraph tag and </p> ends the tag.
<a> Denotes a link and is used like this, <a href=”http://example.com”>Example</a>, the word Example would be the clickable/visible text on the page and the URL is where the link should go to.