Community Forums › Forums › Archived Forums › Design Tips and Tricks › Editing the 404 Error page in Fabric Theme
Tagged: 404 error page, fabric theme
- This topic has 17 replies, 5 voices, and was last updated 8 years, 3 months ago by
David Borrink.
-
AuthorPosts
-
April 28, 2013 at 4:18 pm #38283
Scott Milford
MemberHow can I edit the 404 error page in the Fabric theme? I want to remove some of the items that are showing up.
More specifically, the page shows the standard error message and is followed by a listing of Pages, Categories, Authors, Monthly, and Recent Posts. This a great thing, but it's showing even pages that I had hidden because they're not relevant except in specific situations. Such as when someone is going through the email sign-up process. So if someone stumbles upon a 404 error page, he/she doesn't need to see those and certain other pages. So I'd like to edit the listing so it only shows what's relevant.
Thanks.
http://behaviorandmotivation.comApril 28, 2013 at 4:51 pm #38297AnitaC
KeymasterYou can use the Genesis 404 Page plugin which will allow you to customize/change it - http://wordpress.org/extend/plugins/genesis-404-page/.
Need help with customization or troubleshooting? Reach out to me.
April 29, 2013 at 6:01 pm #38479Scott Milford
MemberAnitac,
The plugin looks fine. But I don't want to start from scratch. I'd really like to just edit what's already there. I don't know how to do that or even where to find the code/plugin/options/settings that cause the page to exist in the first place.
Any ideas how I can edit that existing 404 page that came with the Fabric theme? Or maybe it came with Genesis, I'm not sure. 🙂
Scott
April 29, 2013 at 8:36 pm #38494AnitaC
KeymasterChild themes do not come with a 404 page. You will need to create a custom 404 page or maybe follow the instructions found here - http://dreamwhisperdesigns.com/genesis-tutorials/customize-genesis-404-page/. If you modify the core 404 files in Genesis, they will be overwritten when the upgrade takes effect.
Need help with customization or troubleshooting? Reach out to me.
April 30, 2013 at 6:24 am #38544Brad Dalton
ParticipantHi Scott.
Here's a custom 404 page template for Genesis which includes i'd's for posts and pages you want to exclude from displaying on your error page.
Simply replace the 24,36 with your own page/post i.d's.
Code not displaying? Grab it on Github.
April 30, 2013 at 2:18 pm #38623Scott Milford
MemberAnita & Brad,
First, thanks for taking the time to help me. I really appreciate it! Seriously!
Second, a 404 page already exists. It's not the one I created for my old theme. I don't know where it came from, but I assumed it was part of Genesis or Fabric theme. But if Fabric doesn't come with a 404 error page, it must be a part of Genesis.
Anyway, I really like this 404 error page and want to keep it. Only I'd like to edit it just a little. I don't want to make a brand new 404 page but why redo it if I mostly like what's already there?
So can you (or anyone) tell me how to find the source of this 404 page in Genesis so I can look for the parts that refer to the pages I'd like to not show up? I don't know if I'll find it or be able to edit the pages out, but I think I should be able to.
Thanks!
Scott
April 30, 2013 at 2:25 pm #38625Scott Milford
MemberOkay....I found this:
<?php
/*
WARNING: This file is part of the core Genesis framework. DO NOT edit
this file under any circumstances. Please do all modifications
in the form of a child theme.
*//**
* Handles display of 404 page.
*
* This file is a core Genesis file and should not be edited.
*
* @category Genesis
* @package Templates
* @author StudioPress
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link http://www.studiopress.com/themes/genesis
*//** Remove default loop **/
remove_action( 'genesis_loop', 'genesis_do_loop' );add_action( 'genesis_loop', 'genesis_404' );
/**
* This function outputs a 404 "Not Found" error message
*
* @since 1.6
*/
function genesis_404() { ?><div class="post hentry">
<h1 class="entry-title"><?php _e( 'Not Found, Error 404', 'genesis' ); ?></h1>
<div class="entry-content">
<p><?php printf( __( 'The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it with the information below.', 'genesis' ), home_url() ); ?></p><div class="archive-page">
<h4><?php _e( 'Pages:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_pages( 'title_li=' ); ?>
</ul><h4><?php _e( 'Categories:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_categories( 'sort_column=name&title_li=' ); ?>
</ul></div><!-- end .archive-page-->
<div class="archive-page">
<h4><?php _e( 'Authors:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_authors( 'exclude_admin=0&optioncount=1' ); ?>
</ul><h4><?php _e( 'Monthly:', 'genesis' ); ?></h4>
<ul>
<?php wp_get_archives( 'type=monthly' ); ?>
</ul><h4><?php _e( 'Recent Posts:', 'genesis' ); ?></h4>
<ul>
<?php wp_get_archives( 'type=postbypost&limit=100' ); ?>
</ul></div><!-- end .archive-page-->
</div><!-- end .entry-content -->
</div><!-- end .postclass -->
<?php
}genesis();
I get the feeling that I can only remove the whole PAGE category, rather than individual pages within the PAGE category listing. So does anyone know if there's a way to prevent some pages from showing up in this listing?
April 30, 2013 at 10:38 pm #38678Brad Dalton
ParticipantThe code I provided is exactly as you wanted.
So does anyone know if there’s a way to prevent some pages from showing up in this listing?
Its the Genesis 404 page which I have copied and added a new parameter for excluding page/post i.d's that you don't want displayed.
May 1, 2013 at 2:55 am #38708Scott Milford
MemberBrad,
Oh...now I understand. Okay, so this is not my strength so I need to ask a few questions.
So basically, I just copy the code and pasted it in "404.php", replacing the text that's already there? This is the Genesis 404 Template...one of the core templates for Genesis. Is it okay to replace the text in that file?
How do I determine the page/post ID for the pages I don't want displayed?
Thanks for being patient with me, Brad. 🙂
Scott
May 1, 2013 at 3:52 am #38711Brad Dalton
ParticipantThere's a link at the start of code which explains what to do.
I suggest you copy the code from the view raw link into a new file using Notepad++ and save it as a 404.php file.
Then upload it to your child themes folder.
Please DON'T touch the default 404.php file in the Genesis core. This new file will over ride it.
Hover over the edit or delete links for each page/post you want to exclude from the 404 page and grab the i.d's which appear in the footer of your screen. Its all in the tutorial.
Or install this plugin http://wordpress.org/extend/plugins/reveal-ids-for-wp-admin-25/
May 3, 2013 at 8:29 pm #39199Scott Milford
MemberBrad,
Okay...so far so good. I have excluded the pages that I don't want showing. Now, I need to exclude one item (ID 51) from the category list. How would I do this? My code is below.
Cheers!
Scott------
<?php/**
* Handles display of 404 page not found errors.
*
* Custom 404 page not found error template. Exclude Hidden Pages From 404 Page Not Found Error Page.
*
* @category Genesis
* @package Templates
* @author Brad Dalton
* @link http://wpsites.net/web-design/add-content-404-page-genesis/
*//** Remove default loop **/
remove_action( 'genesis_loop', 'genesis_do_loop' );add_action( 'genesis_loop', 'genesis_404' );
/**
* This function outputs a 404 "Not Found" error message
*
* @since 1.6
*/
function genesis_404() { ?><div class="post hentry">
<h1 class="entry-title"><?php _e( 'Whoops! We Can’t Find What You’re Looking For!', 'genesis' ); ?></h1>
<div class="entry-content">
<p><?php printf( __( 'It appears as if you entered in an invalid URL or maybe the Internet had a hiccup. It’s nothing to worry about. Sometimes the Internet has strange behavior. I’m guessing you’ve been hit by a strong motivation to consider your options. 🙂 Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it with the information below.', 'genesis' ), home_url() ); ?></p><div class="archive-page">
<h4><?php _e( 'Pages:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_pages('exclude=1193,308,1441,113,139,1030,1051,1387,1059,3,77,205&title_li='); ?>
</ul><h4><?php _e( 'Categories:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_categories( 'sort_column=name&title_li=' ); ?>
</ul></div><!-- end .archive-page-->
<div class="archive-page">
<h4><?php _e( 'Authors:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_authors( 'exclude_admin=0&optioncount=1' ); ?>
</ul><h4><?php _e( 'Recent Posts:', 'genesis' ); ?></h4>
<ul>
<?php wp_get_archives( 'type=postbypost&limit=100' ); ?>
</ul></div><!-- end .archive-page-->
</div><!-- end .entry-content -->
</div><!-- end .postclass -->
<?php
}genesis();
------May 4, 2013 at 1:09 am #39220Brad Dalton
ParticipantGood stuff Scott. Please use Pastebin or Github Gists when pasting code here. You can also use shortcodes which you can read more about in the FAQ No.5
So you want to exclude all posts from a category or the category itself?
May 4, 2013 at 11:06 am #39276Scott Milford
MemberBrad,
Before this recent conversation, I didn't know what a "Github Gists" was and the same goes for "Pastebin". So I'll see if I can figure out how to use them. I'm sure it's probably not complex, but I haven't tried to convert any code into numbered lists before such as you do when you paste code.
There's one item showing up in the category list that I'd like to exclude. The ID number for that item is 51.
Scott
May 5, 2013 at 1:34 am #39322Brad Dalton
ParticipantOne item? Do you mean one post? If so, find the i.d for that post and add it to the other i.d's in the code.
May 5, 2013 at 2:26 pm #39439Scott Milford
MemberI don't know if I'm explaining it properly. But as it turns out, the issue somehow fixed itself. Not sure why. But thanks for your help, Brad!! 🙂 You've been a big help and I finally was able to switch over and make the redesigned version of my blog live. 🙂
May 5, 2013 at 2:37 pm #39442Brad Dalton
ParticipantOctober 6, 2013 at 12:25 pm #65574stepheniryna
MemberBrad,
There I was, after creating a custom sitemap (page_archive.php) template. Had excluded categories, author, months, and recent; I only needed pages. Then all I needed to do was exclude a few pages, and Google brought me here (after a few other misses).
Your solution worked great in about 30 seconds.
Thanks.
I only wish there was a way to change the order or the list. My pages don't really make sense in alphabetical order.
January 2, 2017 at 7:02 pm #198651David Borrink
ParticipantBrad, thanks for posting your 404.php example. I used it and brought the search form coding back in from the default 404.php file. Works great!
Scott, thanks for posting this topic. My situation was to eliminate the pages, authors, and monthly listings, leaving the rest as-is.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.