Sidebar Generator issue

I hope this doesn’t come across as very dumb (to some extend it is, however), but I am having a hard time dealing with the Sidebar Generator. In the description it is stated that “Now supports themes with multiple sidebars.”. If I understand this correctly, it would mean that if my theme has let’s say 3 predefined widget areas, using this plugin I’d be able to populate each one of them with different custom sidebars (combinations of widgets) for every single page, right?

To simplify it further, let’s assume that I register sidebars like this:

Read More
if ( function_exists('register_sidebars') ) {
    register_sidebars(3);
}

Then I call them – one in sidebar.php and two in footer.php – like this:

if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) )...
if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) )...
if ( function_exists('dynamic_sidebar') && dynamic_sidebar(3) )...

The plugin documentation states that every instance of dynamic_sidebar() should be replaced with generated_dynamic_sidebar(). Here comes my question then – is it possible to call a sidebar like this:

if ( function_exists('dynamic_sidebar') && generated_dynamic_sidebar(1) )

and still be able to modify it through the Sidebar Generator?

Basically, I’m needing this in order to have 3 separate areas which can be populated with custom sidebars on a per page basis. It, as you’ve already guessed, doesn’t work as desired by me. I can’t replace Sidebar 1 with a custom created sidebar through the plugin. Is it possible to do this and what exactly am I missing? On the other hand, if I call sidebars with

if ( function_exists('dynamic_sidebar') && generated_dynamic_sidebar() )

I am then able to replace them through the plugin by choosing Replace WP Default Sidebar with … which doesn’t actually satisfy me as then I have 3 areas with the same content which is far from useful. I am, to say it again, aiming at having a number of areas with unique identifiers which are able to house different combinations of widgets on different pages.

Any help is greatly appreciated!

P.S. Hope I didn’t sound like a neanderthal! 🙂

Related posts

Leave a Reply

3 comments

  1. the best option here if you want to use a plugin is to use the woo sidebars plugin which is from from woo themes, its also packaged in their free plugin woo dojo which has several free plugins, if your good with options framework by devin or smof and don’t mind using cmb meta boxes by jaredatch then i have a github gist that will allow you to select the total numbers of sidebars to register for use in the widget area, you then have those sidebars appear in a drop down select in a metabox on each page/post/custom post type.

    https://gist.github.com/Firestorm-Graphics/2911578

  2. Your Question: Is it possible to call a sidebar like this?

    if ( function_exists('dynamic_sidebar') && generated_dynamic_sidebar(1) )
    

    No. Also, no need to use functions_exists().

    This is one of the correct methods for registering and calling a sidebar in a template file.

    There’s 2 steps.

    One. This code goes in your functions file

       register_sidebar( array(
        'id'          => 'your-sidebar',
        'name'        => __( 'Your Sidebar', wpsites ),
        'description' => __( 'This is your number 1 sidebar.', wpsites ),
        ) );
    

    Two. This code goes in your template file:

    <?php if ( is_singular('post') && is_active_sidebar( 'your-sidebar' ) ) : ?>
    <div class="your-sidebar">
    <?php dynamic_sidebar( 'your-sidebar' ); ?>
    </div>
    <?php endif; ?>
    

    The above code includes a conditional tag so your sidebar only displays on single posts.

    You can remove the conditional tag or replace with another.

      <?php if ( is_active_sidebar( 'your-sidebar' ) ) : ?>
    <ul id="your-sidebar">
        <?php dynamic_sidebar( 'your-sidebar' ); ?>
    </ul>
       <?php endif; ?>
    
  3. If you want to know about Sidebar Generator issue then you can use this codes:-

    if ( function_exists('dynamic_sidebar') && generated_dynamic_sidebar(1) )
    

    No. Also, no need to use functions_exists().

    This is one of the correct methods for registering and calling a sidebar in a template file.

    There’s 2 steps.

    One. This code goes in your functions file

       register_sidebar( array(
        'id'          => 'your-sidebar',
        'name'        => __( 'Your Sidebar', wpsites ),
        'description' => __( 'This is your number 1 sidebar.', wpsites ),
        ) );
    

    Two. This code goes in your template file:

    <?php if ( is_singular('post') && is_active_sidebar( 'your-sidebar' ) ) : ?>
    <div class="your-sidebar">
    <?php dynamic_sidebar( 'your-sidebar' ); ?>
    </div>
    <?php endif; ?>
    

    The above code includes a conditional tag so your sidebar only displays on single posts.

    You can remove the conditional tag or replace with another.

      <?php if ( is_active_sidebar( 'your-sidebar' ) ) : ?>
    <ul id="your-sidebar">
        <?php dynamic_sidebar( 'your-sidebar' ); ?>
    </ul>
       <?php endif; ?>