404.php
Description: 404.php displays an error page when a user attempts to access a page that doesn't exist.
This template includes the following templates:
Template Code
<?php get_header() ?>
<div id="container">
<div id="content">
<div id="post-0" class="post error404">
<h2 class="entry-title"><?php _e('Not Found', 'sandbox') ?></h2>
<div class="entry-content">
<p><?php _e('Apologies, but we were unable to find what you were looking for. Perhaps searching will help.', 'sandbox') ?></p>
</div>
<form id="error404-searchform" method="get" action="<?php bloginfo('home') ?>">
<div>
<input id="error404-s" name="s" type="text" value="<?php echo wp_specialchars(stripslashes($_GET['s']), true) ?>" size="40" />
<input id="error404-searchsubmit" name="searchsubmit" type="submit" value="<?php _e('Find', 'sandbox') ?>" />
</div>
</form>
</div>
<!-- .post -->
</div>
<!-- #content -->
</div>
<!-- #container -->
<?php get_sidebar() ?>
<?php get_footer() ?>
This template includes the following tags:
_e()is a WordPress function used to mark a string for translation to another language. It is similar to__(), except that__()returns the string while_e()echoes it.bloginfo()is a WordPress function that displays information about your blog. Using various parameters, the function can display the following strings:- Blog title;
- Blog tagline;
- Administrator's email address;
- Document content-type;
- Document charset;
- WordPress version;
- Blog URL;
- Pingback URL;
- URL of the RSS 0.92, RSS 1.0, RSS 2.0, or Atom feed;
- URL of the comments feed;
- URL of the directory in which WordPress is installed;
- URL of the current template's directory;
- URL of the current
style.cssfile; - URL of the stylesheet directory (deprecated)
get_footeris a WordPress include tag which includes the filefooter.php.get_headeris a WordPress include tag which includes the fileheader.php.get_sidebaris a Wordpress include tag which includes the filesidebar.php.stripslashes()is a PHP function that strips backslashes from a string. Single backslashes are removed entirely; a double backslash is replaced with a single backslash.wp_specialchars()is a WordPress function that is "like the PHP function htmlspecialchars except it doesn't double-encode HTML entities." (Function Reference)
HTML Skeleton
[HEADER.PHP] <div id="container"> <div id="content"> <div id="post-[#]" class="post error404"> <h2 class="entry-title">Not Found</h2> <div class="entry-content"> <p>Apologies, but we were unable to find what you were looking for. Perhaps searching will help.</p> </div> <form id="error404-searchform"> <div> <input id="error404-s" /> <input id="error404-searchsubmit" /> </div> </form> </div> <!-- .post --> </div> <!-- #content --> </div> <!-- #container --> [SIDEBAR.PHP] [FOOTER.PHP]
Related CSS Styles
Resources
- Creating an Error 404 Page (WordPress.org)