Title: Widgetizing a custom sidebar
Last modified: August 19, 2016

---

# Widgetizing a custom sidebar

 *  Resolved [onethousandseas](https://wordpress.org/support/users/onethousandseas/)
 * (@onethousandseas)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/widgetizing-a-custom-sidebar/)
 * I think I’m doing this wrong:
 * I’m trying to put in a custom sidebar, so I made a file named “sidebar-optional.
   php”.
 * In the file I put:
 *     ```
       <div id="optionalsidebarcss">
       <ul style="list-style: none;">
       <?php if ( function_exists ( dynamic_sidebar(sidebar-optional) ) ) : ?>
       <?php dynamic_sidebar (sidebar-optional); ?>
       <?php endif; ?>
       </ul>
       </div>
       ```
   
 * In the functions.php file I put:
 *     ```
       <?php 
   
       if ( function_exists ('register_sidebar')) {
           register_sidebar ('sidebar-optional');
       } 
   
       ?>
       ```
   
 * However, any widgets I put in this sidebar won’t show up.
 * Any suggestions?

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

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/widgetizing-a-custom-sidebar/#post-1194151)
 * Change.
 *     ```
       <?php if ( function_exists ( dynamic_sidebar(sidebar-optional) ) ) : ?>
       <?php dynamic_sidebar (sidebar-optional); ?>
       <?php endif; ?>
       ```
   
 * to.
 *     ```
       <?php if ( function_exists ( 'dynamic_sidebar' ) && dynamic_sidebar('sidebar-optional') ) : endif; ?>
       ```
   
 *  Thread Starter [onethousandseas](https://wordpress.org/support/users/onethousandseas/)
 * (@onethousandseas)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/widgetizing-a-custom-sidebar/#post-1194275)
 * Darn, unfortunately that doesn’t work either. Any other ideas?
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/widgetizing-a-custom-sidebar/#post-1194276)
 * When that’s the same code i use to display one of my sidebars…
 * Perhaps there’s a problem with the registering sidebar code…
 * Try using this format..
 *     ```
       register_sidebar(array(
       		'name' => 'PUTNAMEHERE',
       		'before_widget' => '',
       		'after_widget' => '',
       		'before_title' => '<h2>',
       		'after_title' => '</h2>',
       	));
       ```
   
 *  Thread Starter [onethousandseas](https://wordpress.org/support/users/onethousandseas/)
 * (@onethousandseas)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/widgetizing-a-custom-sidebar/#post-1194279)
 * Success! Thank you so much!
 * (Weird because my regular sidebars worked fine on the code I showed you but hey
   as long as it works 🙂
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/widgetizing-a-custom-sidebar/#post-1194282)
 * No worries.. 🙂

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

The topic ‘Widgetizing a custom sidebar’ is closed to new replies.

## Tags

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

 * 5 replies
 * 2 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/widgetizing-a-custom-sidebar/#post-1194282)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
