$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>widgets - Sidebar not show customizer!|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

widgets - Sidebar not show customizer!

matteradmin8PV0评论

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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far