WordPress.org

Ready to get started?Download WordPress

Plugin Directory

SMK Sidebar Generator

This plugin generates as many sidebars as you need. Then allows you to place them on any page you wish.

This plugin generates as many sidebars as you need. Then allows you to place them on any page you wish.

Important info: I'm working for version 3.0 which will support custom sidebars without touching a single line of code. If you want to get acces to first beta, click the following link, subscribe and I will send it to you when it's ready: http://eepurl.com/QeMOf

Demo video:

Features:

  • Full AJAX (add, remove, save, validation, etc.)
  • Drag to sort sidebar position.
  • Name validation(characters and duplicate).
  • Display sidebars using WP built-in function, a custom function or a shortcode.
  • Get registered sidebars anywhere you need them.(theme options, metaboxes, widgets, etc.)

How to install this plugin?

Like any other WordPress plugin.
Drop smk-sidebar-generator to wp-content/plugins/.
More info here: http://codex.wordpress.org/Managing_Plugins#Installing_Plugins

Get all sidebars in an array: Add this function in your theme functions.php:

if(! function_exists('smk_get_all_sidebars') ) {
    function smk_get_all_sidebars(){
        global $wp_registered_sidebars;
        $all_sidebars = array();
        if ( $wp_registered_sidebars && ! is_wp_error( $wp_registered_sidebars ) ) {
            
            foreach ( $wp_registered_sidebars as $sidebar ) {
                $all_sidebars[ $sidebar['id'] ] = $sidebar['name'];
            }
            
        }
        return $all_sidebars;
    }
}

Now using this function you can get all sidebars in an array([id] => [name]):

print_r( smk_get_all_sidebars() )

result of the above code(example)

array(
  "sidebarID" => "Default Sidebar",
  "anotherID" => "Sidebar Name",
  "smk_sbg_18" => "Sidebar Name 1",
  "smk_sbg_7" => "Sidebar Name Something"
)

You can output this anywhere in page/post metaboxes, theme options, etc.

Example with php foreach:

echo '<select>';
  foreach($the_sidebars as $key => $value){
    echo '<option value="'. $key .'">'. $value .'</option>';
  }
echo '</select>';

Display a sidebar using smk_sidebar function:

if(function_exists('smk_sidebar'){
 smk_sidebar('sidebarID');
}

Display a sidebar using wp native function:

if(function_exists('dynamic_sidebar') && dynamic_sidebar('sidebarID')) : 
    endif;

Display a sidebar using built-in shortcode:

[smk_sidebar id="sidebarID"]

Requires: 3.2 or higher
Compatible up to: 3.8.3
Last Updated: 2014-4-3
Downloads: 18,128

Ratings

5 stars
5 out of 5 stars

Support

0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,2,2 100,1,1 100,1,1