Conditional Tags for "Parent" Pages
-
Hi,
So I know this is basic, but i am not able to pull this off.
I have a parent page (not post) called “Books” and under that parent, I have more pages. So this is getting so old… to repeat over and over.I am using something like this PHP for all features of the pages under “BOOKS” to uniquely use same banner, footer and other stuff.
elseif (is_page(‘books’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_brown.png);’; }
elseif (is_page(‘articles’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_brown.png);’; }
elseif (is_page(‘other’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_brown.png);’; }
Somehow – I can’t figure out how to make this IS_PARENT or IS_CHILD so I only have to make this code ONCE for all pages that have the parent “books”.
Any suggestions?
Thank you for your help.Meekr
- The topic ‘Conditional Tags for "Parent" Pages’ is closed to new replies.