Title: Register Sidebar
Last modified: July 13, 2022

---

# Register Sidebar

 *  [WebmasterNYC01](https://wordpress.org/support/users/webmasternyc01/)
 * (@webmasternyc01)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/)
 *     ```
       I am using the code below to register my sidebars and call them but it's not working.
       ```
   
 * /* Add Multiple sidebar
    */ if ( function_exists(‘register_sidebar’) ) { $sidebar1
   = array( ‘before_widget’ => ‘<div class=”widget %2$s”>’, ‘after_widget’ => ‘</
   div>’, ‘before_title’ => ‘<h2 class=”widgettitle”>’, ‘after_title’ => ‘</h2>’,‘
   name’=>__( ‘My sidebar 1’, ‘textdomain’ ), ); $sidebar2 = array( ‘before_widget’
   => ‘<div class=”widget %2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ =>‘
   <h2 class=”widgettitle”>’, ‘after_title’ => ‘</h2>’, ‘name’=>__( ‘My sidebar 
   2’, ‘textdomain’ ), ); $sidebar3 = array( ‘before_widget’ => ‘<div class=”widget%
   2$s”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h2 class=”widgettitle”
   >’, ‘after_title’ => ‘</h2>’, ‘name’=>__( ‘My sidebar 3’, ‘textdomain’ ), ); 
   $sidebar4 = array( ‘before_widget’ => ‘<div class=”widget %2$s”>’, ‘after_widget’
   => ‘</div>’, ‘before_title’ => ‘<h2 class=”widgettitle”>’, ‘after_title’ => ‘
   </h2>’, ‘name’=>__( ‘My sidebar 4’, ‘textdomain’ ), );
 *  register_sidebar($sidebar1);
    register_sidebar($sidebar2); register_sidebar(
   $sidebar3); register_sidebar($sidebar4); }`
 *     ```
       <?php if ( is_active_sidebar( 'My sidebar 1' ) ) { ?>
       			    <ul id="sidebar">
       			        <?php dynamic_sidebar('My sidebar 1'); ?>
       			    </ul>
       			<?php } ?>
       ```
   

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

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15822699)
 * I guess you didn’t post the whole source code here, did you? Because register_sidebar()
   should be called within widget_registration() and widgets_init(). Have a look
   at the examples in the manual: [https://developer.wordpress.org/reference/functions/register_sidebar/](https://developer.wordpress.org/reference/functions/register_sidebar/)
 *  Thread Starter [WebmasterNYC01](https://wordpress.org/support/users/webmasternyc01/)
 * (@webmasternyc01)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15826472)
 * I got that code from the same page. But it is not working.
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15826513)
 * Then please show us all your source code in this regard. As I said, the one above
   does not seem complete to me – it would not work like that.
 *  Thread Starter [WebmasterNYC01](https://wordpress.org/support/users/webmasternyc01/)
 * (@webmasternyc01)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15826552)
 * I copied that from here: [https://developer.wordpress.org/reference/functions/register_sidebar/](https://developer.wordpress.org/reference/functions/register_sidebar/)
 * its towards the bottom.
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15829275)
 * This 4-year-old code is faulty, which can also be seen in the error message in
   debug mode. I would recommend using the newer code from here, as already mentioned
   above: [https://developer.wordpress.org/reference/functions/register_sidebar/#comment-3580](https://developer.wordpress.org/reference/functions/register_sidebar/#comment-3580)
 *  Thread Starter [WebmasterNYC01](https://wordpress.org/support/users/webmasternyc01/)
 * (@webmasternyc01)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15829315)
 * Can you specify which one. there are a quite a few on that page. I need one which
   would enable me to add multiple widgets such in sidebar and footer.
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15829328)
 * I have already put the above link exactly on a suitable comment.
 *  Thread Starter [WebmasterNYC01](https://wordpress.org/support/users/webmasternyc01/)
 * (@webmasternyc01)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15829330)
 * Please do not reply to my thread is you are going to be rude or not clarify when
   asked.

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

The topic ‘Register Sidebar’ is closed to new replies.

## Tags

 * [sidebar widget](https://wordpress.org/support/topic-tag/sidebar-widget/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [WebmasterNYC01](https://wordpress.org/support/users/webmasternyc01/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/register-sidebar-2/#post-15829330)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
