Title: Help modifying functions.php
Last modified: August 19, 2016

---

# Help modifying functions.php

 *  [nisfeb05](https://wordpress.org/support/users/nisfeb05/)
 * (@nisfeb05)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/help-modifying-functionsphp/)
 * I’m trying to modify the functions.php file of a wordpress theme so that I can
   style my widgets easier. The theme I have has two sidebars.
 * The original code for my functions.php is as follows:
 * <?php
    if ( function_exists(‘register_sidebar’) ) register_sidebars(2); ?>
 * I have changed it to the code shown below. If works fine for the first sidebar
   but the second sidebar no longer shows up on my blog.
 * I don’t know how or where to change the below code so that it works with the 
   second sidebar that I believe is called from the original code above as register_sidebars(
   2).
 * Would someone be able to assist me. Below is the new code I am using. Where should
   I be inserting register_sidebars(2)
 * Thank you
 * if ( function_exists(‘register_sidebar’) )
    register_sidebar(array( ‘before_widget’
   => ‘<div class=”widgy”><li id=”%1$s” class=”widget %2$s”>’, ‘after_widget’ =>‘
   </div>’, ‘before_title’ => ‘<h2 class=”widgettitle”>’, ‘after_title’ => ‘</h2
   >’, ));

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

 *  [sysconnweb](https://wordpress.org/support/users/sysconnweb/)
 * (@sysconnweb)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/help-modifying-functionsphp/#post-692778)
 * I jumped into WordPress today and have never looked at the file so I am sorry
   if this doesn’t help – but here we go
 * I noticed something similar to a lot of my Rails work. There’s a slight difference
   that may be affecting your sidebar(s). The original function reads “register_sidebars(
   $var);” and yours now reads “register_sidebar(array(blah));”
 * The difference I see is that the word “sidebar” is singular in YOUR code. Try
   adding the “s” and see if that is a different function. register_sidebar() may
   just be a function for the only (or the first in your case) sidebar that is passed
   through it. register_sidebars() may have a foreach that runs them all.
 * It’s just a thought. Again – I’ve never messed with wordpress code in my life
   so I may be typing in vain.
 *  [Adam Brown](https://wordpress.org/support/users/adamrbrown/)
 * (@adamrbrown)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/help-modifying-functionsphp/#post-692779)
 * Missing the `{` and `}` for the if statement. Should be
 *     ```
       if ( function_exists('register_sidebar') ){
        register_sidebar(array(
          'before_widget' => '<div class="widgy"><li id="%1$s" class="widget %2$s">',
          'after_widget' => '</div>',
          'before_title' => '<h2 class="widgettitle">',
          'after_title' => '</h2>',
        ));
       }
       ```
   
 * and yes, there is a difference between `register_sidebar()` and `register_sidebars()`.
   Spelling always matters.

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

The topic ‘Help modifying functions.php’ is closed to new replies.

## Tags

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

 * 2 replies
 * 3 participants
 * Last reply from: [Adam Brown](https://wordpress.org/support/users/adamrbrown/)
 * Last activity: [18 years, 2 months ago](https://wordpress.org/support/topic/help-modifying-functionsphp/#post-692779)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
