Community Forums › Forums › Archived Forums › Design Tips and Tricks › Hide footer area on certain pages?
- This topic has 7 replies, 2 voices, and was last updated 6 years, 4 months ago by
Brad Dalton.
-
AuthorPosts
-
September 13, 2019 at 7:29 am #493542
ilkweb
ParticipantDoes anyone have a link to a tutorial on hiding site-footer on certain pages?
I'm not talking about widgets but rather the entire footer. I've used a conditional logic plugin on footer widgets but naturally the footer still shows albeit empty (except for the background-color).
The conditional logic in the snippet below is what I'm intending to use to show the footer for those pages.
is_page( array( 47, 18, 20 ) ) || is_404() || is_search()September 14, 2019 at 2:35 am #493559Brad Dalton
ParticipantSeptember 14, 2019 at 4:31 am #493561ilkweb
ParticipantI think I wrongly described what I'm trying to do.
I actually want to remove the footer widgets plus the footer widgets area. The footer, I understand, is where the credits reside.
September 14, 2019 at 4:39 am #493562Brad Dalton
ParticipantThe code in this tutorial should get you started however you will need to use the correct conditional tags.
September 14, 2019 at 4:41 am #493563ilkweb
ParticipantI've used the following in
functions.phpto hide the actually footer widgets wrapper which I'm describing as the "footer widgets area":/* Show footer widget area on certain pages */ add_action( 'genesis_before', 'wpsites_display_footer_home' ); function wpsites_display_footer_home() { if( !is_page( array( 47, 18, 20 ) ) || 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); }}I'm also using a conditional logic plugin for individual widgets to hide the four widgets I have:
is_page( array( 47, 18, 20 ) ) || is_404() || is_search()This is working so far but I think I could probably lose the conditional logic plugin.
September 14, 2019 at 4:43 am #493564Brad Dalton
ParticipantYes, no need for the plugin when you have coded the conditionals into the PHP.
September 14, 2019 at 4:52 am #493565ilkweb
ParticipantI actually do need the plugin though - Without it, the widgets show up where I don't want them to. I've yet to replace the conditionals I put into the plugin with the equivalent conditionals in
functions.php.I've been looking for a way to do this, as seemingly, what I presently have in
functions.phpis not sufficient.September 17, 2019 at 2:39 am #493597Brad Dalton
ParticipantOnce you add the correct conditionals to the code in functions.php, you'll no longer need the plugin.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.