Finally an easy one. The 404 error page (Page Not Found) is pretty easy to make. It’s just a very stripped down version of your index.php file without all that bothersome content in it. First you create a file in your theme folder named 404.php. Then you open the file for editing. Now enter the following content into the file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php get_header(); ?> <div id="content"> <h2>Sorry, the page you requested was not found.</h2> <div class="warning"> <p>Apologies, but we were unable to find the page that you requested.</p> </div><!-- close warning --> <div class="encourage"> <p>Don't go away disappointed though! Visit us at <a href="<?php bloginfo ('siteurl') ; ?>"><?php bloginfo ('name') ; ?></a> and see what we have to offer!</p> </div><!-- close encourage --> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> |
As you can see, the 404 page just displays the header, sidebar and footer along with a custom 404 error that encourages our visitor to check out our blog main page. We will clean up the presentation of this page and others when we add our styles.
I also decided to add a missing item that I like to include in the sidebar.php file. I opened that file for editing and added the following block of code just above the closing UL tag in the PHP print statement near the bottom.
1 2 3 4 | ?> <li><h2>Meta</h2><ul> <li><?php wp_loginout(); ?></li></ul></li> <?php |
wp_loginout () – generates a login link or if the user is already logged in it generates a logout link. This is not really critical in a theme, but I like to add it because it is very helpful to have a login link as a blog author or administrator. I added it to the side bar because it is a less obvious there than the header menu. Call it my humble effort at security by ignorance.

