By default, when any of your WordPress website page or post that is being accessed is unavailable then a 404 error page is displayed.By default, 404 error page shows a “Page not Found” message along with some links to other resources.
Default 404 Error Page in Genesis ?
If your WordPress website is developed on the top of Genesis framework then the 404 error page by default displays “ Not Found, Error 404” message in addition it also displays all the available pages, categories, authors, archives and recent posts from your WordPress site.
Why do we need Custom 404 Error Page in Genesis ?
If you have any broken links on your WordPress website by chance then having a custom 404 Error page can make sure you don’t loose traffic & it enables users and search engines to access other important pages on your website.Having a custom 404 page can drastically reduce bounce rates.
How To Customize Genesis 404 Error Page :
Customizing 404 Page in Genesis Theme should be a fairly simple process.The tutorial below explains you on how to create a custom error 404 page for your WordPress website running the Genesis Framework.
Although there is an default 404 error page I would suggest you to create an Custom 404 error Genesis page template of your own as this can help you standout from the crowd.
- First of All, Download & backup your default 404.php which is located at the root folder of Genesis Framework.
- Now using your favorite text editor like TextPad edit the 404.php to modify it as per your requirements like adding custom <title> tag, Custom Page title , Custom message at top of page ,Added images to the 404 error page
- Once you are done with modifying 404.php then Save the changes & upload the 404.php file back to your Genesis theme folder.
From there on an custom 404 page will be displayed when ever an user encounters a 404 error on your WordPress website.
Additional Code Snippets for Genesis 404 Error Page :
Below are some code snippets which can help you create your own custom 404 error page in Genesis Theme.
Display List of Categories in 404 Genesis Theme error Page.
The below code when added to the 404.php will displays the list of all categories sorted in the order.
<h4><?php _e( 'Categories:', 'genesis' ); ?></h4> <ul><?php wp_list_categories( 'sort_column=name&title_li=' ); ?></ul>
Display Recent Posts in 404 Genesis Theme error Page.
After adding the below code to 404.php file, The 404 Page will display titles of the recent post’s published on your WordPress blog dependning on the number of posts you want to display.If you want to control the number of posts to be displayed, change the limit value to a number of your Liking.
<h4><?php _e( 'Recent Articles:', 'genesis' ); ?></h4> <ul><?php wp_get_archives( 'type=postbypost&limit=
9' ); ?></ul>
Show the List of Pages in Genesis 404 Page
You can also show the list of all the pages on your WordPress site in your Custom 404 Page using the below code.
<h4><?php _e( 'Pages:', 'genesis' ); ?></h4> <ul><?php wp_list_pages( 'title_li=' ); ?></ul>
I wrote this tutorial for BlogHunk Readers after analyzing & understanding similar Genesis tutorial written by Bharath @ WPsquare.
That’s it! You have just completed creating custom 404 page in Genesis Theme.If you have any queries drop a comment and we are always glad to help you.