Editing the 404 Error page in Fabric Theme

Community Forums Forums Design Tips and Tricks Editing the 404 Error page in Fabric Theme

This topic is: not resolved

This topic contains 16 replies, has 4 voices, and was last updated by  stepheniryna 10 months, 3 weeks ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #38283

    Scott Milford
    Participant
    Post count: 19

    How 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.com
    #38297

    Anita
    Participant
    Post count: 7490

    You can use the Genesis 404 Page plugin which will allow you to customize/change it – http://wordpress.org/extend/plugins/genesis-404-page/.


    When asking for help, please provide a link or screen shot showing your problem!
    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me!

    #38479

    Scott Milford
    Participant
    Post count: 19

    Anitac,

    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

    #38494

    Anita
    Participant
    Post count: 7490

    Child 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.


    When asking for help, please provide a link or screen shot showing your problem!
    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me!

    #38544

    braddalton
    Participant
    Post count: 9287

    Hi 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.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #38623

    Scott Milford
    Participant
    Post count: 19

    Anita & 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

    #38625

    Scott Milford
    Participant
    Post count: 19

    Okay….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?

    #38678

    braddalton
    Participant
    Post count: 9287

    The 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.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #38708

    Scott Milford
    Participant
    Post count: 19

    Brad,

    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

    #38711

    braddalton
    Participant
    Post count: 9287

    There’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/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #39199

    Scott Milford
    Participant
    Post count: 19

    Brad,

    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();
    ——

    • This reply was modified 1 year, 3 months ago by  Scott Milford.
    • This reply was modified 1 year, 3 months ago by  Scott Milford.
    #39220

    braddalton
    Participant
    Post count: 9287

    Good 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?


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #39276

    Scott Milford
    Participant
    Post count: 19

    Brad,

    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

    #39322

    braddalton
    Participant
    Post count: 9287

    One 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.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #39439

    Scott Milford
    Participant
    Post count: 19

    I 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. :-)

Viewing 15 posts - 1 through 15 (of 17 total)

You must be logged in to reply to this topic.