List all sidebar names?

Loop through the global:

<select>
<?php foreach ( $GLOBALS['wp_registered_sidebars'] as $sidebar ) { ?>
     <option value="<?php echo ucwords( $sidebar['id'] ); ?>">
              <?php echo ucwords( $sidebar['name'] ); ?>
     </option>
<?php } ?>
</select>

Note:
The ucwords() function is only there to display it exactly as you asked. Not sure if you really want that.


How to access global arrays & objects:

Anyway: Your Q mostly is about how to access arrays. I wrote a Q about that (for further explanation). Please take a look over here.

Leave a Comment