How to display default widgets on sidebar?

Question

I want to display widgets to sidebar while previewing theme on wordpress.org

Now I turned on sidebar but by while previewing on wordpress.org the sidebar is empty.
Is it possible to display widgets while previewing?

My Code to register sidebar

<?php for( $i = 1; $i <= 4; $i++ ){
    register_sidebar( array(
        'name'          => sprintf( esc_html__( 'Footer Widget Area %d ', 'text-domain' ), $i ),
        'id'            => 'footer_sidebar_' . $i,
        'description'   => 'Footer sidebar',
        'before_widget' => '<section id="%1$s" class="widget %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>',
    ));
}

My code to diplay sidebar

<?php for( $i = 1; $i <= $num_footer ; $i++ ){
    if ( is_active_sidebar( 'sidebar_' . $i ) ) : ?>
        <aside class="col footer-widget-wrapper">
            <?php dynamic_sidebar( 'footer_sidebar_' . $i ); ?>
        </aside>
    <?php endif;
} ?>
0
Prajwol 4 months 0 Answers 16 views 0

Leave an answer