Register your Custom Sidebar

To register your own custom sidebar in wordpress, you just need to write the following code inside “twentytwelve_widgets_init()” function which is present in functions.php in your theme folder.

register_sidebar( array(
 'name' => __( 'your sidebar name', 'twentytwelve' ),
 'id' => 'sidebar-4',    // must be unique 
 'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),
 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
 'after_widget' => '</aside>',
 'before_title' => '<h3 class="widget-title">',
 'after_title' => '</h3>',
 ) );

after adding this code in your functions.php, go to your admin panel and you will get your custom sidebar.

To call your sidebar inside your template file just write the following code.

<?php dynamic_sidebar( 'sidebar-4' ); ?>

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.