How to customize 404 Error Page in Thesis Theme

This tutorial is exclusively for Thesis Framework, a new templating system for WordPress. Create any sort of layout for your website using Drag & Drop Builder.

Share This Article:

Thesis is one of the most popular WordPress theme frameworks used by bloggers and webmasters. Each and every part of thesis can be easily customized using thesis hooks. Here is an excellent tutorial that helps to customize the 404 error page in your thesis theme. It is advised to have a custom 404 error page, so that first time visitors will turn into regular readers of your blog.

customize 404 Error Page in Thesis Theme

Now, coming to the code part, entire 404 page can be controlled using thesis theme hooks. As you are experimenting on theme files, it is advised to back up your theme.

You need to edit this file in custom folder of Thesis Theme

custom_functions.php

Also Read : 5 Reasons why we choose Genesis over Thesis

Adding a title to 404 Error Page in Thesis Theme

You need a title to let your readers know, that the page they are trying to access is not available. To do that, simply add the below code to custom_functions.php and save it.

function custom_thesis_404_title() {
?>
<h2>Bad Luck! Cant find the page you are looking for ?</h2>
<?php
}
remove_action('thesis_hook_404_title', 'thesis_404_title');
add_action('thesis_hook_404_title', 'custom_thesis_404_title');

Functionality of this code :

  • It will remove the default 404 title and add a custom 404 title.
  • Replace the heading between <h2> and </h2> tags with the one you like.
  • Now, lets move-on to the content part of 404 page.

Read this : How to Login to WordPress using Email Address

Adding content to 404 Error page in Thesis Theme

The best way to craft a 404 error page is by adding latest articles to it. Now, include the below code in custom_functions.php and save it.

function custom_thesis_404_content() {
?>
<p>Try your luck by checking these recent articles</p>
<ul>
<?php
global $post;
$args = array( 'numberposts' => 10,'order'=> 'DESC','orderby'=> 'post_date');
$postslist = get_posts( $args );
foreach($postslist as $post) : setup_postdata($post); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php
}
remove_action('thesis_hook_404_content', 'thesis_404_content');
add_action('thesis_hook_404_content', 'custom_thesis_404_content');

Functionality of this code :

  • It will remove the default 404 content and add a custom 404 content.
  • You can also define number of posts by changing the value in
    ‘numberposts’ => 10.

Also Check : How to add 3 column footer to WordPress theme

You are done with customizing 404 error page in thesis theme, we also design awesome child skins for thesis theme, Please contact us to get a quote. Meanwhile Subscribe to our feeds, to receive awesome tutorials like this.

Please drop a comment, if you need any help regarding this article.

This tutorial is exclusively for Thesis Framework, a new templating system for WordPress. Create any sort of layout for your website using Drag & Drop Builder.

Genesis is the most flexible WordPress theme framework that comes with tons of options. We have been using Genesis on all of our blogs and recommending the same to you. Every bit of it is coded according to the standards. Give it a try!

Comments

  1. Umer says:

    i think this line has some issue. i am having issue in this line. Someone have a word on this…

    • WPSquare says:

      Issues fixed and its working fine now. Thank you.

  2. Chris says:

    I’ve been looking for this tip everywhere. Thanks to this code, I now have 1 less plugin installed.
    Thanks!!

Speak Your MindComments Policy →

*

Looking for More Awesomeness?

Read previous post:
Remove or Change Post Meta in Genesis Theme
How to Remove or Change Post Meta in Genesis Theme Framework

Genesis is one of the best WordPress theme frameworks and it got "Post Meta" function by default. This function helps...

Close