• 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

Show/hide footer area conditional logic is mis-firing in functions.php

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 › Design Tips and Tricks › Show/hide footer area conditional logic is mis-firing in functions.php

This topic is: not resolved

Tagged: 404, conditional, footer, functions, hide, show

  • This topic has 5 replies, 3 voices, and was last updated 2 years, 10 months ago by ilkweb.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • April 28, 2020 at 6:02 am #498239
    ilkweb
    Member

    Hi all. I'm having an issue with a conditional code snippet that is supposed to show the footer only on certain pages.

    It works except for the is_404() page.

    Here's my snippet:

    /* Show footer widget area on certain pages */
    add_action( 'genesis_before', 'wpsites_display_footer_home' );
    function wpsites_display_footer_home() {
    if( !is_page(455) || is_404() || is_search() ) {
    remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
    remove_action('genesis_footer', 'genesis_do_footer');
    remove_action('genesis_footer', 'genesis_footer_markup_open', 5);
    remove_action('genesis_footer', 'genesis_footer_markup_close', 15);
    }}

    And here's a link to a deliberately forced 404 page: https://gsg.hk/en/ffgfgfgfg

    Notice that the footer in the 404 link above is only partially showing. It is missing its outer HTML container footer class="site-footer"

    By contrast, the following page is showing correctly with the footer: https://gsg.hk/en/search/

    I can only imagine my is_404() in functions.php is mis-firing. Any clues as to why?
    Appreciate all and any ideas!

    Thanks, Darren

    April 28, 2020 at 1:03 pm #498248
    Anita
    Keymaster

    Hi Darren, did you ever reach out to @braddalton about the code questions??


    Love coffee, chocolate and my Bella!

    April 30, 2020 at 4:22 am #498308
    ilkweb
    Member

    I didn't Anita. I don't really want to bother him.

    April 30, 2020 at 10:22 am #498323
    Anita
    Keymaster

    Well it's @braddalton's code you're using. So the best source for making his code work would be him.


    Love coffee, chocolate and my Bella!

    May 2, 2020 at 4:27 am #498383
    Victor Font
    Moderator

    Brad's code is removing the footer widgets from the genesis_before_footer area. Your footer widgets have been moved to be inside the actual footer, not the before footer area.

    There's nothing wrong with Brad's code because it is using the default Genesis layout. Your theme, for whatever reason, has been modified and is not using the default Genesis layout.

    Since your theme, Governance Solutions, is not a Studio Press theme, I suggest you read through functions.php to find the code that moved the footer widgets so you can adjust Brad's code accordingly, or contact the theme developer for further assistance.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    May 2, 2020 at 7:46 am #498385
    ilkweb
    Member

    Thanks, Victor.

    I never thought Brad's code was wrong, but I do know that the Business Pro theme I used had been heavily customised even before I started tweaking it.

    I've reached out to SEO Themes, the makers of Business Pro, with a complete and detailed message identifying the problem, and to ask which hooks I ought to be targeting to remove the footer completely on certain pages.

    Thanks again! Stay safe!

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ 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