Home » Wordpress

WordPress: Optimizing 404 Page Not Found page

22 December 2009 136 views Popularity: 1% Share/Bookmark

email

Generally the wordpress 404 page contains one or two sentence saying that the page is not found. But you can make it more user friendly. Instead of just writing plain text about page not found, we can display archive list and a search form. In this way, the visitor can search or browse your website instantly. This is a nice way to keep your visitors within your site.

I got this idea from wp-comfy theme.

Copy the following code into 404.php of your theme. With this change, you will be able to see search form and archive list in 404 page of your site.

<?php get_header(); ?>

	<div id="content">

	<div class="post">

	<h2 class="title">Cannot find the page you're trying to reach..</h2>

		<div class="entry clearfloat">
			<p>Use the search form below to find your article or post or browse our latest articles to read something more interesting.</p>
			<p>
			<form class="find" method="get" action="<?php bloginfo('url'); ?>/">

					<input size="40" type="text" value="<?php the_search_query(); ?>" name="s" class="findfield" />
					<input type="submit" value="Search" class="findsubmit" />

			</form>
			</p>

			<h3>Yearly Archive</h3>
			<ul><?php wp_get_archives('type=yearly&amp;show_post_count=1'); ?></ul>
			<h3>Monthly Archive</h3>
			<ul><?php wp_get_archives('type=monthly&amp;show_post_count=1'); ?></ul>
			<h3>Category Archive</h3>
			<ul><?php wp_list_cats('sort_column=name&amp;optioncount=1') ?></ul>
			<h3>Posts Archive</h3>
			<ul><?php wp_get_archives('type=postbypost') ?></ul>

		</div>

	</div>

	</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Related posts:

  1. WordPress: Create custom archive page
  2. How to show child page (sub page) list in parent page in wordpress?
  3. WordPress: Archive link not working
  4. Left or Right Align your image, adsense code or other advertisement in wordpress
  5. WordPress Contact Form 7: Quick Fix to spinning arrow displays forever & no success/error message displayed
  6. Disqus: Solution to Error ‘Closing Tag Mismatch’ in RSS Feed
  7. WordPress Plugin: Quick Adsense 1.0
  8. An introduction to RSS
  9. Twitter, Facebook, WordPress getting together
  10. What are Meta-Tags? Full Description of Meta tags