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 someone who doesn’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 instead of having to alter code. For the advanced, Thesis has incredible customization possibilities via Thesis hooks.
For those "in between", like myself, I’ve created "dummy" guides for Thesis hooks that allow us to make more professional customizations than we ever deemed possible. The theme is not only highly customizable, but it has allowed me to run Sugarrae more professionally, with a much more targeted focus on monetization than it ever has been able to achieve before. You can find out more about Thesis below:
- Thesis Website and Demo
- Thesis Theme Review
- Thesis Tutorial: Hooks for Dummies
- More Thesis Tutorials on Sugarrae









Comments on this entry are closed.