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
5,925 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..