Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

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! :)

share|improve this question
    
If I understand what you are asking you may not need a plugin to do that, you can register all the sidebars you want and format them as you like, don't know if you checked this and if you want different widgets according to pages I suggest using Dynamic Widgets plugin hope this helps. –  Poxtron Mar 28 '13 at 6:14
    
The sidebar generator plugin was last updated more than 3 years ago! A lot has changes in WordPress in 3 years... I would suggest you take a look at this page on how to manually create sidebars: codex.wordpress.org/Function_Reference/register_sidebar It's as simple as copy-pasting some lines in your theme's functions.php file –  WPMU-DEV Ari Apr 5 '13 at 14:48

2 Answers 2

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

share|improve this answer
    
Please work on the formatting of this answer, and include the relevant code inline-- an answer should not depend on a third party site. To be clear, your answer is to 1) use a plugin by Woo or 2) use code that depends on one of two frameworks and a plugin(?). How does that answer/solve the OP's question, which doesn't seem related to any of those things? –  s_ha_dum Apr 6 at 14:10
    
The plugin in question is over 3 years old is not updated in that time and my answer gives great alternatives, and no you didn't understand my answer, woo sidebars is very close in functionality, is upto date and vastly supported, the code i referred to would allow the functionality without plugin. answers the question well i think –  Firestorm_dev Apr 6 at 14:17
1  
Perhaps if all of the relevant information were written into to answer it would answer the question well. As is, it is barely more than a quip: "How do I replace the brakes on my car? Well, you use tool-a, or tool-b and tool-c, to take off the old brakes and put on the new ones." That really isn't a helpful answer. We try to do better here. Again, please work on the formatting of this answer, and include the relevant code inline-- an answer should not depend on a third party site. Maybe browse the help center so that you understand the stack a little better. –  s_ha_dum Apr 6 at 14:35

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; ?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.