• Does anyone know the correct syntax for checking if the options/controls in a specific Section of customizer.php are not empty? Trying to check if one of the options/theme_mods if filled out, I can’t find what I’m looking for anywhere..

    I’m trying to do something like this:

    <?php if (!empty($wp_customize->get_section('special_section'))) : ?>
    
      <div>Div goes here...</div>
    
    <?php endif; ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • See if this helps.

    Thread Starter Shane Taylor

    (@propertunity)

    no not really. I read through all that, but my skills are intermediate at best and I’m not sure what I’m looking for. I’ve spent 7+ hours on this and have only been able to rule out what doesn’t work….

    thanks though…

    • This reply was modified 6 years, 10 months ago by Shane Taylor.

    Look towards the bottom. There are several examples of how to write it.

    Thread Starter Shane Taylor

    (@propertunity)

    all i see is how to create sections and settings/controls…

    I’m trying to display a div on the frontend, and what i’m currently doing that works is something like this:

    <?php 
        
      if (
    
        ( !empty(get_theme_mod('mod1')) ) 
    
        ||
    
        ( !empty(get_theme_mod('mod2')) ) 
    
        ||
    
        ( !empty(get_theme_mod('mod3')) )   
    
      ) : 
    
    ?>
    
    <div id="mods" class="container-fluid"></div>
    
    <?php endif; ?> 

    but I know doing it that way is a little hacky… just trying to check if any of the settings inside the parent section are being used.. instead of checking each theme_mod (there are over 20)

    Moderator bcworkz

    (@bcworkz)

    @propertunity – please do not post multiple topics on the same subject. In order to keep future related replies all in one place, I’m closing this topic. Please continue at
    https://wordpress.org/support/topic/wp-customizer-show-div/

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Customizer Section’ is closed to new replies.