Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I added the ability to the theme customizer for the user to remove a section that is above the footer. The issue is when the section is removed it is causing the links in my footer to move up.

How it works is the user can click a checkbox in the theme customizer to hide/show a section. How that works is it saves a 0 or 1 setting in the theme_mod setting and then in my html for that page I check what the setting is with logic and if 0 the section stays and if 1 it's removed.

So I am thinking I need to add the same logic in the footer to see if the section was removed and then add padding to the footer. I am wondering what the standard way to do this is. I have a couple of ideas but I am wondering if their is a specific way with WP and theme customizer that it can add an additional properties to a class if the checkbox is checked and section removed.

If no one knows of a specific way for WP and theme customizer then could you give advice on these ideas?

I could create a second footer in my stylesheet and then add the code to the html to check if the theme_mod setting is checked and if so show the second footer, if not keep the original. Like this:

<?php if( newtheme_theme_mod( 'remove_above_footer_section' ) == '') { ?>
<div class="footer">

<?php } else {?>
//section was removed
<div class="footer2">

<?php } ?>

My second idea was to check to see if the section was removed by checking the property again and then adding the extra properties for the padding right into the html that shows the div class. Something like this:

<?php if( newtheme_theme_mod( 'remove_above_footer_section' ) == '') { ?>
<div class="footer" style= "padding-top:50px">

<?php } ?>
share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.