Support » Fixing WordPress » How to call specific header for child pages of parent?

  • Resolved svsdnb


    I am designing a custom theme that essentially has 3 site sections.

    MAIN PAGE (header-home.php)

    Secondary Main Page (header-ph.php)

    Third Main Page (header-bh.php)

    Each section will have a dynamic nav in relation to the parent page you’re on.

    Right now I can get each Parent page to pull it’s respected header however the child pages to each parent pull in the default header.

    Here is my code.

    <?php get_header (‘home’); ?>

    ?php get_header(‘publichealth’); ?>

    PublicHealth.php template is called to the Public Health parent page. I then created subpages (child pages) from this parent. However the header resorts to the ‘home’ header vs the ‘publichealth’ header.

    What sort of conditional code do I need in here to make this happen? I’ve searched and tried a few suggestions with no luck.

    Thank you,

Viewing 1 replies (of 1 total)
  • omg. I feel dumb… Next link I found and I got it.

    this worked for me


    if (is_page() || $post->post_parent==456) {
    } elseif (is_page() || $post->post_parent==72) {
    } else {
    $subpagefix=”/header-home.php” ; // Fall-through

    <?php include (TEMPLATEPATH . $subpagefix ); ?>

    I just posted this on the page.php file in place of get_header

Viewing 1 replies (of 1 total)
  • The topic ‘How to call specific header for child pages of parent?’ is closed to new replies.