Community Forums › Forums › Archived Forums › Design Tips and Tricks › hide sub footer left and right widgets on a few pages?
Tagged: Outreach Pro, sub-footer
- This topic has 18 replies, 5 voices, and was last updated 8 years, 2 months ago by Tony-BV.
-
AuthorPosts
-
January 12, 2014 at 2:02 pm #84805lindebjergMember
I would like to hide sub footer left and right widgets on some pages.
http://granum.weborbis.de/
Page IDs where to hide the widgets: 822, 43, 1044January 12, 2014 at 3:13 pm #84825Brad DaltonParticipantAdd a conditional tag after the function in the PHP code.
https://gist.github.com/braddalton/c589bc2b43ffc2184421
January 13, 2014 at 4:15 am #84933lindebjergMemberI have tried to inset your code into the function.php, but it did not change anything?
January 13, 2014 at 4:25 pm #85062Brad DaltonParticipantHello @lindebjerg
Just tested the code locally on the Outreach Pro theme. Please try again.
Copy ALL the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++.
January 14, 2014 at 3:21 am #85116lindebjergMemberif I do so, the site turns all blank ;(
January 15, 2014 at 8:43 pm #85440Brad DaltonParticipantI tested the code which works perfectly.
Please copy ALL the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++
June 28, 2016 at 8:37 am #188444Tony-BVParticipantHi Braddalton, I was looking to do the same thing. I tried using this code with my page and my site crashed. I got an erron message so I had to use the backup function.php. Here is the code I used. Any advice for me? Thanks
//* Add the sub footer section
add_action( 'genesis_before_footer', 'outreach_sub_footer', 5 );function outreach_sub_footer() {
if ( !is_page( array ( 139 ) ) ) {
if ( is_active_sidebar( 'sub-footer-left' ) || is_active_sidebar( 'sub-footer-right' ) ) {
echo '<div class="sub-footer"><div class="wrap">';genesis_widget_area( 'sub-footer-left', array(
'before' => '<div class="sub-footer-left">',
'after' => '</div>',
) );genesis_widget_area( 'sub-footer-right', array(
'before' => '<div class="sub-footer-right">',
'after' => '</div>',
) );echo '</div><!-- end .wrap --></div><!-- end .sub-footer -->';
}
}
}June 29, 2016 at 1:38 am #188501Brad DaltonParticipantTry this
//* Add the sub footer section add_action( 'genesis_before_footer', 'outreach_sub_footer', 5 ); function outreach_sub_footer() { if ( is_page( 139 ) ) return; if ( is_active_sidebar( 'sub-footer-left' ) || is_active_sidebar( 'sub-footer-right' ) ) { echo '<div class="sub-footer"><div class="wrap">'; genesis_widget_area( 'sub-footer-left', array( 'before' => '<div class="sub-footer-left">', 'after' => '</div>', ) ); genesis_widget_area( 'sub-footer-right', array( 'before' => '<div class="sub-footer-right">', 'after' => '</div>', ) ); echo '</div><!-- end .wrap --></div><!-- end .sub-footer -->'; } }
June 29, 2016 at 7:27 am #188517Tony-BVParticipantThanks for the response, but that did not work either. This is the error message I got: Fatal error: Cannot redeclare outreach_sub_footer() (previously declared in /home/preloade/public_html/wp-content/themes/outreach-pro/functions.php:89) in /home/preloade/public_html/wp-content/themes/outreach-pro/functions.php on line 158
June 29, 2016 at 7:32 am #188518Brad DaltonParticipantOnly add the function once otherwise change both instances of the function name
outreach_sub_footer
June 29, 2016 at 7:47 am #188522Tony-BVParticipantDoes that mean you want me to remove the other function? I'm a little confused. Can I send you the file? Thanks
June 29, 2016 at 8:05 am #188523Brad DaltonParticipantPaste the code into a Github Gist and link to it from here please.
June 29, 2016 at 8:20 am #188525Tony-BVParticipantThis reply has been marked as private.June 29, 2016 at 9:07 am #188530ChristophMemberPSA: If you mark a post/reply as private only you and moderators can see it.
June 29, 2016 at 9:29 am #188535Tony-BVParticipantOK I did not know that. Here you go https://gist.github.com/Tony-BV/9b9ce6a01e11ea2652b022e038bd3051
July 2, 2016 at 2:09 pm #188782Tony-BVParticipantHi, I never heard back so I wanted to be sure you got my last reply. Here you go https://gist.github.com/Tony-BV/9b9ce6a01e11ea2652b022e038bd3051
July 3, 2016 at 10:52 pm #188823Genesis DeveloperMemberReplace this line
if ( is_active_sidebar( 'sub-footer-left' ) || is_active_sidebar( 'sub-footer-right' ) ) {
WITH
if ( is_active_sidebar( 'sub-footer-left' ) || is_active_sidebar( 'sub-footer-right' ) && ( ! is_page( 139 ) ) ) {
July 4, 2016 at 2:34 am #188830Brad DaltonParticipantJuly 4, 2016 at 8:58 am #188854Tony-BVParticipantThanks Braddalton, that worked. Thank you for taking the time to help. This is one of the reasons why I only use you guys for all my blogs. Happy 4th Of July!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.