Support » Themes and Templates » Cleaning up my conditional tags…help

  • Resolved Meeker Jones

    (@mikaanami)


    Hi all,

    So this is getting so old.

    1. is there a way to consolidate the condistional tags to each page?
    Right now I am separating them in the header for each function.

    2. I still can’t figure out the page parent / child conditional tags. For example – my books page is the parent to ‘articles’ and ‘others’ page. How do i simply make the conditional tags to make those same page have the same look? (in these cases banners, background colors, footer band color.. )

    3. here is the site to show you how every page has a different theme

    4. I will also like to learn how to make posts under a certain “category” to show up with a different background color, banner, link band footer color…

    Here are all the conditional tags I got in the header – for starters.
    Really don’t want to add more of these when I make “child” pages…. 🙁

    #link-colorband { <?php if (is_page(‘ginny’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_blue.jpg);’; }

    elseif (is_page(‘contact’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_blue.jpg);’; }

    elseif (is_page(‘ennin’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_brown.jpg);’; }

    elseif (is_page(‘ennin-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_brown.jpg);’; }

    elseif (is_page(‘green-road’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_brown.jpg);’; }

    elseif (is_page(‘trees’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_purple.jpg);’; }

    elseif (is_page(‘liao-jin’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_green.jpg);’; }

    elseif (is_page(‘trees-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_purple.jpg);’; }

    elseif (is_page(‘liao-jin-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_green.jpg);’; }

    elseif (is_page(‘books’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_blue.jpg);’; }

    elseif (is_page(‘articles’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_blue.jpg);’; }

    elseif (is_page(‘other’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/link_band_blue.jpg);’; }

    ?> }

    #page-wrap { <?php if (is_page(‘ginny’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_ginny.png);’; }

    elseif (is_page(‘contact’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_books.png);’; }

    elseif (is_page(‘news’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_blog.png);’; }

    elseif (is_page(‘ennin’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_ennin.png);’; }

    elseif (is_page(‘ennin-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_ennin.png);’; }

    elseif (is_page(‘green-road’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_ennin.png);’; }

    elseif (is_page(‘trees’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_tree.png);’; }

    elseif (is_page(‘trees-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_tree.png);’; }

    elseif (is_page(‘liao-jin’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_liaojin.png);’; }

    elseif (is_page(‘liao-jin-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_liaojin.png);’; }

    elseif (is_page(‘books’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/bg_books.png);’; }

    ?> }

    #footer-colorband { <?php if (is_page(‘ginny’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_pink.png);’; }

    elseif (is_page(‘contact’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_brown.png);’; }

    elseif (is_page(‘ennin’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_purple.png);’; }

    elseif (is_page(‘ennin-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_purple.png);’; }

    elseif (is_page(‘green-road’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_purple.png);’; }

    elseif (is_page(‘trees’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_green.png);’; }

    elseif (is_page(‘trees-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_green.png);’; }

    elseif (is_page(‘liao-jin’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_yellow.png);’; }

    elseif (is_page(‘liao-jin-activities’)) { echo ‘background-image: url(‘.get_stylesheet_directory_uri().’/images/footer_band_yellow.png);’; }

    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);’; }

    ?> }

    THANKS!!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Cleaning up my conditional tags…help’ is closed to new replies.