• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

404 Page Not Working

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › 404 Page Not Working

This topic is: not resolved

Tagged: 404

  • This topic has 2 replies, 2 voices, and was last updated 7 years, 6 months ago by d7fhx.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • November 7, 2015 at 8:41 pm #170437
    d7fhx
    Member

    I noticed that my 404 page wasn't working when invalid URLs were used and am wondering how to fix the issue. The 404 page is working on some of my other sites but not on my site below. The Genesis framework is up to date as is my WP installation and all of my plugins. Also, I'm using the corporate theme and the 404.php file is identical to that used in the genesis subdirectory for my other sites.

    Any ideas on how to configure Genesis to use the Genesis 404 page?

    http://www.iprofitinteractive.com
    November 8, 2015 at 11:19 am #170483
    Tom
    Participant

    Looks like you've got this fixed, yes?


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    November 8, 2015 at 12:23 pm #170491
    d7fhx
    Member

    Yes, my 404.php in the child theme was set to a filesize of 0 bytes after my site was hacked. I made a copy of the 404 file in the Genesis folder and modified it.

    That said, I want to customize the 404 page so that I can choose what contents to display. Some things like authors doesn't make sense to display. The main code calls genesis_sitemap so I'm thinking that I can modify that function in the child theme. I put some quick code in place to display just the page names/links. I seem to remember there's an easy way to customize the 404 page within the console but I haven't been able to find it.

    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() {

    echo genesis_html5() ? '<article class="entry">' : '<div class="post hentry">';

    printf( '<h1 class="entry-title">%s</h1>', apply_filters( 'genesis_404_entry_title', __( 'Not found, error 404', 'genesis' ) ) );
    echo '<div class="entry-content">';
    if ( genesis_html5() ) :
    echo apply_filters( 'genesis_404_entry_content', '<p>' . sprintf( __( 'The page you are looking for no longer exists. Perhaps you can return back to the site\'s homepage and see if you can find what you are looking for. Or, you can try finding it by using the search form below.', 'genesis' ), trailingslashit( home_url() ) ) . '</p>' );
    get_search_form();
    else :
    ?>
    <p><?php printf( __( 'The page you are looking for no longer exists. Perhaps you can return back to the site\'s homepage and see if you can find what you are looking for. Or, you can try finding it with the information below.', 'genesis' ), trailingslashit( home_url() ) ); ?></p>
    <?php
    endif;
    /** MODIFIED CODE */ wp_list_pages( 'title_li=' );
    echo '</div>';
    }

    genesis();

    /** ORIGINAL CODE - this is the code I replace with the above modified code */
    if ( ! genesis_html5() ) {
    genesis_sitemap( 'h4' );
    } elseif ( genesis_a11y( '404-page' ) ) {
    echo '<h2>' . __( 'Sitemap', 'genesis' ) . '</h2>';
    genesis_sitemap( 'h3' );
    }
    echo '</div>';
    echo genesis_html5() ? '</article>' : '</div>';

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble