28b3b77e67ee8f360583ce7aac56abc0

Customizing Thesis WordPress Theme 404 Error Pages

by Harsh Agrawal on August 17, 2009

in Thesis Customization

No one likes 404 Error pages. A 404 Error page is the requested page that doesn’t exist. When a user open a page on your blog, and that page do not exist on your blog, he will get a 404 error.

In normal scenario user will hit the back button or close the page. The loss will be yours since you will not be getting and visits on your page.

How to customize Thesis WordPress theme 404 Error Page

By adding a simple code we can add style to our Thesis 404 error page, but our goal should be show some related content to your 404 error page, so that visitor will still stick to your blog.

To achieve the desired result we need :

Smart 404 Plugin : Smart 404 plugin will help you to customize your 404 error pages. If you don’t have Thesis wordpress theme, you can also use this plugin on non Thesis blogs.

Download the plugin and activate it. Now Edit your custom_functions.php file which is located at Thesis > Custom folder. Add following code to customize the 404 Error page and show some related content

/* Custom 404 Hooks */
function custom_thesis_404_title() {
?>
The Page you requested is somewhere here.
<?php
}

remove_action('thesis_hook_404_title', 'thesis_404_title');
add_action('thesis_hook_404_title', 'custom_thesis_404_title');

function custom_thesis_404_content() {
?>
<p>Can't find what you looking for?</p>

<?php if (smart404_loop()) : ?>
<p>Check out These related posts:</p>
<?php while (have_posts()) : the_post(); ?>
<h4><a href="<?php the_permalink() ?>"
  rel="bookmark"
title="<?php the_title_attribute(); ?>">
<?php the_title(); ?></a></h4>
  <small><?php the_excerpt(); ?></small>
<?php endwhile; ?>
<?php endif; ?>

<?php
}

remove_action('thesis_hook_404_content', 'thesis_404_content');
add_action('thesis_hook_404_content', 'custom_thesis_404_content');

You can see an example by Opening this link

http://www.shoutmeloud.com/error

Customizing your blog 404 Error page will ensure lower bounce rate.

If you still missing the benefit of SEO perfect wordpress theme, I will recommend get Thesis wordpress theme or read following posts :

Related posts:

  1. How to add Digg and Tweetmeme Button In Thesis WordPress Theme
  2. How to add Twitter ID into Thesis wordpress Theme Comment Form
  3. Customizing Comment Form in Thesis 1.7 WordPress Theme
  4. Fixing CodePress Error In Thesis WordPress Theme
  5. 15 Thesis Theme Resources Roundup
  6. Getting Started With Thesis WordPress Theme
  7. Thesis Open Hook WordPress Plugin : Easily customize Thesis WordPress Theme
  8. Adding Adsense Into Thesis WordPress Theme

Do you like this story?

Wpfreelancer

{ 19 comments… read them below or add one }

1 Shanker Bakshi August 17, 2009 at 23:21

Thesis is really difficult to customize as they say, thank that few blogger like you helping other to heck it professionaly.
.-= Shanker Bakshi ´s last blog ..Do You Want to Become Rich Overnight? =-.

Reply

2 Harsh Agrawal August 19, 2009 at 04:29

That’s true Shankar at first glance it seems to be hard to customize. though with little bit of work, you can easily customize thesis and give it any kind of shape you want.

Reply

3 Marlene August 18, 2009 at 02:18

This post reminds me to check if my new theme has the 404 file. I normally create one when the theme doesn’t have, but it slipped my mind this time.

Everybody’s blogging about Thesis Theme, it makes me more curious to have one.

Reply

4 Harsh Agrawal August 18, 2009 at 02:24

Thesis is no doubt a powerful theme, and people who are using it. They can only understand the real power beneath it. I’m sure one day when you will have this theme you will realize the meaning of words above :)

Reply

5 Stefan August 18, 2009 at 03:55

It really feels like Thesis and Wordpress are getting more and more connected. Maybe the Wordpress team will get inspired and integrate some of Thesis functions into standard Wordpress.
.-= Stefan ´s last blog ..69 Inspirational Quotes eBook =-.

Reply

6 Harsh Agrawal August 19, 2009 at 04:36

I really wish if they will, but last time at word camp we had a word with Matt (Founder of Wordpress), and we talked about integrating All in One SEO with wordpress, though he prefer those independent components should grow independently. So This is something, IMO is not going to happen. but there is nothing to worry about, why to look for bits of it, when we can grab the whole package :)

Reply

7 Surender Sharma August 18, 2009 at 11:25

Thank you Harsh.
I was finding the way to customize error 404 page.
.-= Surender Sharma ´s last blog ..Do you Dream of Creating a Massive Blog =-.

Reply

8 Harsh Agrawal August 19, 2009 at 04:39

I’m glad Surender that this post helped you.

Reply

9 George Serradinho August 18, 2009 at 12:52

I nice little hack if I say so myself. I checked the error page and it looks cool. I’m sure we could many other details on that page if we wanted to :)
.-= George Serradinho ´s last blog ..Premium Elegant Theme =-.

Reply

10 George Serradinho August 18, 2009 at 13:08

Hi,

I tried implementing the above and it comes back with smart404_loop is not defined. When I remove that if statement then it works fine.
.-= George Serradinho ´s last blog ..Premium Elegant Theme =-.

Reply

11 George Serradinho August 18, 2009 at 14:37

I have actually now used this code and changed it a bit so that I don’t need another plugin.
.-= George Serradinho ´s last blog ..Premium Elegant Theme =-.

Reply

12 Harsh Agrawal August 18, 2009 at 15:01

Hey George
Will love to know the code you used, since it will be helpful to get rid of one extra plugin. Though there is one thing which I forget to mention in the post. This plugin also tries to match the post slug, and instead of giving 404 error it will open the relevant link. This will help a lot in order to narrow down the 404 error pages.
For an example open this link :
http://www.shoutmeloud.com/facebook-chat-box-sidebar

Reply

13 George Serradinho August 18, 2009 at 17:19

I just sent you an email, need to have a look at what you wanted. Will let you know if I come right.
.-= George Serradinho ´s last blog ..Premium Elegant Theme =-.

Reply

14 Harsh Agrawal August 19, 2009 at 04:41

Got your codes and I will post it here are SML with your Credit :)

Reply

15 Christie August 19, 2009 at 06:18

This is great Harsh, thanks! Another thing for my list of things I need to do SOON. I have posts redirected to my current blog from some old blogs, so chances are someday a redirect is going to fail and some readers will definitely land on the 404 page – which I currently just have the default that comes with Thesis.
.-= Christie ´s last blog ..Why aren™t my trackbacks working? =-.

Reply

16 canon5dshooter September 12, 2009 at 22:08

Its great to see so much support for the Thesis theme. Thank you so much for outlining how to add custom 404 support to my Thesis blog. As I continue to develop the structure of the blog this feature will prove to be very useful.
.-= canon5dshooter ´s last blog ..9/9/9 “ Leica M9 Rangerfinder for 6999! =-.

Reply

17 Michael May 15, 2010 at 06:24

I am still learning theis, which is driving me mad. Where do I put the code in the custom functions, the top, the bottom, etc. I keep getting an internal server error.
Thanks

Reply

18 HIDUP SEORANG BLOGGER September 2, 2010 at 23:39

this awesome. thanks for sharing :)

Reply

19 Harsh Agrawal September 4, 2010 at 23:33

I’m glad you liked it.. :)

Reply

Leave a Comment

Previous post:

Next post:

ShoutMeLoud on Twitter ShoutMeLoud on Facebook ShoutMeLoud RSS Feed