Support » Fixing WordPress » header iamges for parent/child pages

  • Resolved ke vinritt

    (@ke-vinritt)



    I used this code to have a different header based on parent pages

    [Code moderated as per the Forum Rules. Please use the pastebin]

    it works fine but when I select a child page, it reverts to the default header image. Is there a way to have the image stay in the header for each parent and child page of that parent?
    Here’s a link to the site If you look at the parent page “the academy” you’ll see the header image but it changes when I select a child page from the menu on the left

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorry, code is here at pastebin
    Also, I tried adding 2 pages in the is_page but that did not work

    took a couple of days but I got it:
    <?php if (is_page(‘the-academy’) || $post->post_parent == ‘4’) { ?>
    // use the slug of the parent page and then the ID
    <img src=”<?php bloginfo(‘template_url’); ?>/headers/academy-header.jpg” width=”960″ height=”152″ alt=”<?php bloginfo(‘name’); ?> The Academy” />
    <?php } else { ?>
    <img src=”<?php bloginfo(‘template_url’); ?>/headers/default-header.jpg” width=”960″ height=”152″ alt=”<?php bloginfo(‘name’); ?> Rotating Header Image” title=”<?php bloginfo(‘name’); ?> MCAEC” />
    <?php } ?>
    This worked for me. C-O-D-E-X

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘header iamges for parent/child pages’ is closed to new replies.