WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a site that uses multiple query taxonomy archives.

i.e www.sitename.com/taxonomy1/taxonomy2/taxonomy3

Is there a plugin or method to create a dedicated sidebar for each queried taxonomy archive?

Essentially, there will be 1000 or so archives and i would like to be able to create a unique sidebar for each. Is this possible?

Thanks in advance


share|improve this question
up vote 1 down vote accepted

I've had luck dynamically creating sidebars using a foreach loop. You'd do something like this (untested) in your functions.php file:

$my_terms = get_terms( 'my_taxonomy_name' );
if( ! is_wp_error( $my_terms ) ) {
    foreach( $my_terms as $term ) {
            'name' => $term->name . ' Archive Sidebar',
            'id' => 'archive_sidebar_' . $term->term_id

Then, in your taxonomy-my_taxonomy_name.php template file, you'd use something like this (untested) to get your sidebar (some code borrowed from this answer):

$term_slug = get_query_var( 'term' );
$taxonomy_name = get_query_var( 'taxonomy' );
$current_term = get_term_by( 'slug', $term_slug, $taxonomy_name );
dynamic_sidebar( 'archive_sidebar_' . $current_term->term_id );

Now, having said all that, I question whether this is a good idea. Assuming that generating 1000 sidebars doesn't have a negative performance affect on WordPress (which is a BIG assumption), the UI for the backend user would be terrible. I can't imagine finding the sidebar I actually wanted to use.

While it would be confusing still, I'd encourage you to use Widget Logic or, if you have non-code-savvy users, Widget Logic Visual.

Alternately, drop the whole idea of widgets sidebars and accomplish whatever you need by just using get_query_var() to figure out which term archive you're on in the template and then execute some context-aware code in the template file.

share|improve this answer
Thanks for the response, I will actually take you last bit of advice and use a query to generate the content in one sidebar. This will generate the required results based on the archive. It wil be much easier to handle than all those sidebars : ) – PaulB May 8 '12 at 12:07
@PaulB Sounds like a good idea! You had me worried there. If this answered your question, make sure to accept it as the right answer. – mrwweb May 8 '12 at 13:49

try this -


its easy and simple !

share|improve this answer
Welcome to WordPress Answers! An answer should be more than just a link to an external site. Please add a solution. – toscho Sep 4 '12 at 4:04

Your Answer


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.