Decorative Flower
Her Realm, Personal website and blog of Cole
Nov 14

One small step for man; a slightly bigger step for Cole

I just figured out a way to assign my dynamic sidebars for each section a little better/easier/simpler than how I was doing it before. I was also able to delete 4 or so template files. All in all? Not a miracle or anything but it took a little experimentation and I’m quite proud!

Essentially, instead of calling one sidebar in all places, I ask it to call a sidebar for a page and all its children like so:


if ( is_page(‘pagename’) || $post->post_parent == ‘parentid’) {


} elseif (is_page(‘page2name’) || $post->post_parent == ‘parent2id’) {


} else {



Comments are closed.

Skip to toolbar