Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development Finishing Your WordPress Theme Adding Widget Areas to a WordPress Theme

not operator in front of dynamic_sidebar() ?

Hey I didn't understand why not operator is used here in front of function dynamic_sidebar()

2 Answers

Christie Parkhurst
Christie Parkhurst
6,059 Points

The "not" operator is basically saying, if there is no side bar widget set up in admin, show whatever code you have typed directly into the template instead.

kelley riley
kelley riley
3,159 Points

Yeah I think I understand what you were getting at here Ashish. If "Contact" is a page sidebar then using the "!" operator would prevent that html from showing up. You'd want it to say: "IF this is a page sidebar then do this". I had to remove the operator to get this to work..