Why does a variable work on the front page but return NULL on all other pages?

Hi @orbit82:

Searching through the code in WordPress v3.0.4 I was unable to find any references to a global $sidebar_id so I am assuming that either your theme is setting it on the front page or a plugin you are using is setting it. Can you verify?

What’s more, I would definitely echo @prettyboymp’s comment that you should look to use the conditional tags like is_single() and is_archive(); is there a reason they won’t work for you? Here’s a reference on the WordPress Codex for what conditional tags are available in WordPress: