WordPress.org

Ready to get started?Download WordPress

Forums

Conditional Tags for "Parent" Pages (2 posts)

  1. Meeker Jones
    Member
    Posted 1 year ago #

    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

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    check and see if using this 'snippet 4' would work:
    http://codex.wordpress.org/Conditional_Tags#Testing_for_sub-Pages

Topic Closed

This topic has been closed to new replies.

About this Topic