Community Forums › Forums › Archived Forums › Design Tips and Tricks › Show/hide footer area conditional logic is mis-firing in functions.php
- This topic has 5 replies, 3 voices, and was last updated 4 years, 4 months ago by ilkweb.
-
AuthorPosts
-
April 28, 2020 at 6:02 am #498239ilkwebParticipant
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()
infunctions.php
is mis-firing. Any clues as to why?
Appreciate all and any ideas!Thanks, Darren
April 28, 2020 at 1:03 pm #498248AnitaCKeymasterHi Darren, did you ever reach out to @braddalton about the code questions??
Need help with customization or troubleshooting? Reach out to me.
April 30, 2020 at 4:22 am #498308ilkwebParticipantI didn't Anita. I don't really want to bother him.
April 30, 2020 at 10:22 am #498323AnitaCKeymasterWell it's @braddalton's code you're using. So the best source for making his code work would be him.
Need help with customization or troubleshooting? Reach out to me.
May 2, 2020 at 4:27 am #498383Victor FontModeratorBrad'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 #498385ilkwebParticipantThanks, 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!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.