• Resolved cosmic-emma

    (@cosmic-emma)


    On my website each parent page has a different header. I have been able to generate this successfully by using this code:

    <?php
    $post = $wp_query->post;
    if ( is_page(‘page1’) ) {
    include(TEMPLATEPATH . ‘/header-1.php’);
    }
    ?>

    But when I go to a child page no header is showing.

    What I need is for child pages to show the same header as its parent.

    Any idea?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter cosmic-emma

    (@cosmic-emma)

    Unfortunately, I’m still not getting anywhere.

    Parents have different headers and the child pages need to show their parent’s headers – can someone shed some more light on how to do this?

    Thread Starter cosmic-emma

    (@cosmic-emma)

    Okay I got this to work, this maybe the long way of doing things but it does work!

    I have this code in the header.php linking to other specific headers:
    <?php
    $post = $wp_query->post;
    if ( is_page(‘page1’) ) {
    include(TEMPLATEPATH . ‘/header-1.php’);
    }if ( is_page_template(‘one-page.php’) ) {
    include(TEMPLATEPATH . ‘/header-1.php’);
    if ( is_page(‘page2’) ) {
    include(TEMPLATEPATH . ‘/header-2.php’);
    }if ( is_page_template(‘two-page.php’) ) {
    include(TEMPLATEPATH . ‘/header-2.php’);
    }
    ?>

    Each section has it’s own page-template which is allowing me to target the child pages with the parent.

    If anyone else has a better way please let me know?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Child page to show same header as Parent page’ is closed to new replies.