widgets - Sidebar not show customizer!

admin2025-06-04  2

It's showing widgets.php:

Not showing customizer:

sidebar.php

function footer_sidebar()
{
    register_sidebar(
        array(
            'name' => __( 'Footer Sidebar 1', 'footer1' ), 
            'id' => 'footer1',
            'description' => __( 'Footer Sidebar 1', 'footer1' ),
            'before_widget' => '<div id="footer1" class="col-md-4" style="margin-bottom:10px;margin-top:-25px;">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3>', 
            'after_title' => '</h3>',
        )
    );

    register_sidebar(
        array(
            'name' => __( 'Footer Sidebar 2', 'footer2' ), 
            'id' => 'footer2',
            'description' => __( 'Footer Sidebar 2', 'footer2' ),
            'before_widget' => '<div id="footer2" class="col-md-4" style="margin-bottom:10px;margin-top:-25px;">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3>', 
            'after_title' => '</h3>',
        )
    );
}
add_action( 'widgets_init', 'footer_sidebar' );

footer.php

<div class="row">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer1') ) : ?><?php endif; ?>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer2') ) : ?><?php endif; ?>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer3') ) : ?><?php endif; ?>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer4') ) : ?><?php endif; ?>
</div>

It's showing widgets.php:

Not showing customizer:

sidebar.php

function footer_sidebar()
{
    register_sidebar(
        array(
            'name' => __( 'Footer Sidebar 1', 'footer1' ), 
            'id' => 'footer1',
            'description' => __( 'Footer Sidebar 1', 'footer1' ),
            'before_widget' => '<div id="footer1" class="col-md-4" style="margin-bottom:10px;margin-top:-25px;">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3>', 
            'after_title' => '</h3>',
        )
    );

    register_sidebar(
        array(
            'name' => __( 'Footer Sidebar 2', 'footer2' ), 
            'id' => 'footer2',
            'description' => __( 'Footer Sidebar 2', 'footer2' ),
            'before_widget' => '<div id="footer2" class="col-md-4" style="margin-bottom:10px;margin-top:-25px;">', 
            'after_widget' => '</div>', 
            'before_title' => '<h3>', 
            'after_title' => '</h3>',
        )
    );
}
add_action( 'widgets_init', 'footer_sidebar' );

footer.php

<div class="row">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer1') ) : ?><?php endif; ?>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer2') ) : ?><?php endif; ?>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer3') ) : ?><?php endif; ?>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer4') ) : ?><?php endif; ?>
</div>
Share Improve this question edited Feb 11, 2016 at 22:16 Howdy_McGee 20.9k24 gold badges91 silver badges177 bronze badges asked Feb 11, 2016 at 22:07 Yakup SeymenYakup Seymen 293 bronze badges 2
  • Have you tried this? – TheDeadMedic Commented Feb 13, 2016 at 18:13
  • Remember to add wp_head() before </header> tag and wp_footer() before </body> tag. It works for but I had the same problem. – Daniel Szantar Commented Jan 4, 2019 at 20:30
Add a comment  | 

2 Answers 2

Reset to default 2

You have to put the function footer_sidebar() in the file functions.php not sidebar.php

Is the footer.php included on site you opened the customizer?

You might be forgotten to add wp_footer(); function before the closing body tag in your footer.php. That causes the javascript cannot finish its instruction in the customizer.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749043322a315872.html

最新回复(0)