WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 would like to load different right and left sidebars depending on a custom taxonomy term. If there is no term from this custom taxonomy, then just load the default sidebar.php and sidebar-right.php files.

For example, the alternate sidebars would be something like:

  • sidebar-carrots.php and sidebar-carrots-right.php
  • sidebar-apples.php and sidebar-apples-right.php
  • etc.

I know about the Widget Logic plugin, but I want more control and need to load completely different sidebar template files.

I'm sure that I could throw together something messy and functional, but I would like to know what is the best way to set that up.

share|improve this question

There are 2 options that comes in mind

First use a conditional statement is_tax('taxonomy-name', 'term name').

is_tax('fruits', 'apples'){
} if is_tax('fruits', 'oranges') {

Or, the second option, use a different template file instead.

taxonomy-fruits-apples.php should use


taxonomy-fruits-oranges.php should use


Hope this help

share|improve this answer

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.