WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Dynamics Sidebars

Have a custom sidebar (widget area) for every pages, posts and/or custom post types.

Want your pages, posts and/or custom post types to have different sidebar? An awesome plugin that let you have a custom sidebar (widget area) for every page, post and/or custom post type.

Documentation | Support Forum

Usage

By default it will add 'custom-sidebar' support for the following post types:

  • Post
  • Page

IMPORTANT: Showing the sidebar

Note you can use this wherever you like to show you sidebar

<?php
    dynamic_sidebar( get_the_sidebar() );
?>

Or

<?php
    $sidebar = get_the_sidebar();
    if ( is_active_sidebar( $sidebar ) ) {
        dynamic_sidebar( $sidebar );
    }
?>

Adding support for custom post type

In order to user this plugin features with your custom post type you must add a feature suppport to it. Do it by doing this:

On you 'functions.php' file

<?php
    add_action( 'after_setup_theme', 'theme_setup' );

    function theme_setup()
    {
        add_post_type_support( 'post_type', 'custom-sidebar' );
        // add another one here
    }
?>

When you register your custom post type, on 'register_post_type' call.

Function Reference register_post_type for more information

<?php
    $args = array( 'supports' => array( 'custom-sidebar' ) );
    register_post_type( 'post_type', $args );
?>

Removing support for pages, posts and/or custom post types

To remove support from pages, posts and/or custom post type do like so: On you 'functions.php' file add this

<?php
    add_action( 'after_setup_theme', 'theme_setup' );

    function theme_setup()
    {
        remove_post_type_support( 'post', 'custom-sidebar' ); // to remove from posts
        remove_post_type_support( 'page', 'custom-sidebar' ); // to remove from pages
        remove_post_type_support( 'custom post type', 'custom-sidebar' ); // to remove from ctp
    }
?>

Changing sidebar args

On your 'functions.php' file just add the following code.

<?php
    add_filter( 'ds_sidebar_args', 'my_sidebar_args', 1, 3 );

    function my_sidebar_args( $defaults, $sidebar_name, $sidebar_id ) {
        $args = array(
            'description'   => "$sidebar_name widget area",
            'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
            'after_widget'  => '</li>', 'after_widget',
            'before_title'  => '<h3 class="widget-title">',
            'after_title'   => '</h3>', 'after_title',
        );

        return $args;
    }
?>

Documentation | Support Forum

Don't forget to check the 'Other Notes' tab for a list of all function and hook you can use.

Requires: 3.0 or higher
Compatible up to: 3.4.2
Last Updated: 2012-8-18
Downloads: 8,600

Ratings

4 stars
4 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.
1 person says it's broken.

100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 100,2,2
100,1,1 40,5,2 67,3,2
100,1,1
0,1,0
100,1,1 100,1,1 100,1,1 100,1,1 100,2,2 100,1,1 100,1,1
100,1,1
50,2,1
0,1,0