If you're new here, you may want to subscribe to my feed or subscribe to me on Twitter, which is updated on a more frequent - and more meaningless - basis.
A few weeks ago, I published a Thesis theme tutorial that showed you how to do advanced ad targeting. The tutorial showed you how to assign ads to be different based on the category the posts were filed in, as well as change them on a post by post basis.
While “You 404′d it. Gnarly, dude.” is a semi-custom page since it does keep with your theme and design, you may want to give it a little bit of your own personality and wording to make it truly “custom”. Below, I’ll show you how to do it.
Step 1: Open your custom_functions.php file (thesis > custom > custom_functions.php) in your favorite editor
Step 2: Underneath the example code already in the file, place the following code (this code assumes your blog is in the root):
/* Custom 404 Hooks */
function custom_thesis_404_title() {
?>
YOUR 404 PAGE HEADING HERE
<?
}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>WHATEVER YOU WANT YOUR 404 PAGE TO SAY HERE</p>
<?
}remove_action(’thesis_hook_404_content’, ’thesis_404_content’);
add_action(’thesis_hook_404_content’, ’custom_thesis_404_content’);
The /* Custom 404 Hooks */ is a label for the code below so you know what it is at a single glance and is not part of the actual “code”. The word “function” tells Thesis you want it to do something. The custom_thesis_404_title is what I decided to name that function.
You’ll notice this code has two functions. One controls the 404 page heading (custom_thesis_404_title) and one controls the 404 page content (custom_thesis_404_content).
The code is pretty self-explanatory on how to edit. The two lines underneath each function tell Thesis to remove it’s default thesis_404_title and thesis_404_content and replace each with the custom versions. (See hooks for dummies for a more detailed explanation of how this hook “works.”)
Custom 404 pages are your only chance to turn a lost visitor into a site user, so you want to make sure you serve up something that makes a good first impression. If you need some 404 inspiration, check out these 100 awesome and creative 404 error pages.
Subscribe to the Sugarrae feed | Follow Sugarrae on Twitter
Related Posts
Sugarrae runs on the Thesis WordPress Theme
If you’re a blogger looking for a professional presence but don’t understand a lot of PHP, Thesis will give a ton of functionality that you wouldn’t be able to obtain otherwise with a simple control panel. With the incredible customization possibilities via Thesis hooks, you can easily make your blog stand out from the crowd.
Thesis allows bloggers to make more professional customizations than they may have ever deemed possible due to lack of coding knowledge. The theme allows me to run Sugarrae more professionally, with a focus on monetization that is more targeted than I’ve ever been able to achieve with a theme before. You can find out more about Thesis below:







{ 1 trackback }
{ 21 comments… read them below or add one }
I guess there is now nothing else for me to do then to make a custom Thesis 404 page as this article shows it to be pretty simple… thanks for the guide!
Since you’re always dooling out these cool thesis tutorials I would love to know how you add that spiffy blue thesis promotion box to your post!
Find me at Sphinn | Twitter | WebmasterWorld
Actually, that little tidbit (how to make the blue box) is coming out as an exclusive tutorial for my newsletter subscribers at the end of this month - so subscribe now so you don’t miss it :)
Find me at Twitter
Thanks, this is just what I was looking for. The custom 404 message of Thesis does not sound like me at all and does not make a good impression. Rae, you’re the only one standing between me and regretting buying Thesis. Thank you!
PS Can’t wait for your newsletter
Short, sweet and effective. Very good to point people on the forums to. Lovely!
Nice! I just recently discovered Thesis and absolutely love it. Thanks for the tips!
No wonder you’re one of the Top 10 Most Influential Women in Social Media in Canada. With tutorials like this, it’s not a mystery. I’m using Thesis (which I adore) so I’m going to edit the 404 page based on your tips.
Great post, very informative and well layed out, thanks alot :)
This is a great tutorial Rae, but I’m curious why Thesis simply doesn’t have a custom 404 page layout which would allow the user to create the 404 title/content from within the WP admin panel, or does it?
Hmmm, in any event, this tutorial has inspired me to create a quick little tutorial for theme authors so they can do exactly that.
Thanks so much for this tutorial. But a question: if my blog does not sit in the root of my site, how do I need to tweak this code? Or can I not use it at all?
Find me at Sphinn | Twitter
Hello Rae,
I apllied the code to change the 404 page on one of my sites, but i still get the ususal 404 “You 404’d it. Gnarly, dude.”-page when entering a not existing page. What did i do wrong?
Best regards,
Fil
Good tutorial, I always knew my 404 page should be something a bit more descriptive. This will help, now to decide what to do with it!
I agree with Phil, I am having a little trouble getting the new 404 to show up? I posted the text and ran with it, I’ll just have to get tinkering
@filontheroad: check the quotes in the copied paste. I noticed when I pasted into Textmate it maintained the ‘fancy’ quotes, and wasn’t working. When I changed the quotes to standard quotes, it worked fine.
@kyle thanks for helping out. I had the same problem while copying the code to textmate with the quotes. ;-)
I recently designed a site that I used custom 404 pages. I’ve never done it before I read you post and I like the way it works. Thanks!
Hi Rae, I’ve seen some very creative 404 pages that used images to add humor or interest. But I have Googled it to death and cannot find how to do more than change the text. Do you have any experience with this? Thanks.
Thanks for this Rae — not using Thesis (I know, I know…) but will implement with the theme I have in place. The idea behind customizing the 404 page isn’t new, but your tutorial and perspective is helpful.
The list of “100 awesome and creative” 404 pages is actually the jewel of this post. Favourites have to be the ‘Truth Behind 404′ and the ‘Whining, Nerd Twins’. Damn, wish I could say that I don’t identify with the latter…
Anyway, thanks again. (Chuck Norris, how could I not mention Chuck Norris!?!?)
The “fancy” quotes weirdness also gave me a problem — thx for the above pointers, after I did a find-and-replace I was good to go!
OMG check out what I did, yayzerama Sugarrae!
» http://torley.com/404
What I generally do it redirect user to main page of the site and add a 404 message at the top.