Timeline for How to add a class when there's no sidebar?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 30, 2012 at 20:03 | comment | added | user25381 | Sorry but i dont understand csn you explain please? | |
Dec 30, 2012 at 19:09 | comment | added | fuxia♦ |
get_sidebar() happens long after body_class() has been called. Your sidebar.php should not create any HTML if there are no sidebars, then it will work.
|
|
Dec 30, 2012 at 19:02 | comment | added | user25381 | I removed get_sidebar(); from the template file, but your code adds has-sidebar every time. | |
Dec 30, 2012 at 18:57 | comment | added | fuxia♦ |
This code should work like that: if no sidebar has been defined a class .no-sidebar will be added.
|
|
Dec 30, 2012 at 18:56 | comment | added | user25381 | I need something like the twentyeleven theme. I can create pages with sidebar, and without sidebar. If no sidebar added the template adds a "singular" class to the body. Thank you! | |
Dec 30, 2012 at 18:50 | history | answered | fuxia♦ | CC BY-SA 3.0 |