WordPress.org

Ready to get started?Download WordPress

Forums

Problem with Conditional Statements in header for parent pages (3 posts)

  1. TPConline
    Member
    Posted 2 years ago #

    Hello,

    Website: tooklandpentecostalchurch.org

    I Have been trying to get a different header image on each page this is what I have come up with http://pastebin.com/aW2FmVWi. I used a If is(front_page) then used elseif is_page(permalink for page) for all the pages that I wanted different images then closed with a else statement thinking that this would suffice ALL other pages except the ones that I specified above. This worked great until I got to the pages that have a parent or are a parent, then all my pages are except posts are called by

    <div id="<?php echo $post->post_name; ?>">
    <img src="<?php bloginfo('template_url'); ?>/headers/header_<?php echo $post->post_name; ?>.jpg" />
    </div>

    so I have a page to test my designs and plugins call /test it is not referenced in any of my code but the header image that is being pulled is called header_test.jpg when is should be header_1.jpg

    I am new to php so you might want to dumb everything down tho any help is appreciated

    Thanks
    -Matt

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

  3. TPConline
    Member
    Posted 2 years ago #

    Thanks for the post SwansonPhotos,

    I read through it and it looks like if I have no other choice I would go down this road but right now I can make the code I have work by adding the header images named header_"page title" ... I just wanted help troubleshooting why I can't get certain pages to revert to what I am setting as default or else.

    thanks
    -Matt

Topic Closed

This topic has been closed to new replies.

About this Topic