• I am developing a custom template and want to change the header on certain pages. I would like to use the ‘get-header{‘name’) syntax, but I been unable to get it work. I have created a second header,php file with the name: header-match.php.

    How do I get this documented feature to work. I have checked the documentation both on the ‘get-header’ page and function in wordpress include files.

    I am missing something in interpreting the documentation?

    Help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi

    Try something like this syntax

    <?php
    if (is_page('a_page_name')) {
      include (TEMPLATEPATH . '/header_1.php');
    } elseif  (is_page('another_pagename')) {
      include (TEMPLATEPATH . '/header2.php');
    } else {
      get_header();
    }
    ?>

    Thread Starter tomunthank

    (@tomunthank)

    Thank you for your answer stvwlf. I may use your code suggestion if I cannot found out to make “get_header(‘name’) to work.
    I am continuing to look for the ability to use: get_header(‘name’) to change the header on several different pages with different header information. This techniques is described in the 2.7 notes in the codex and the code that should make it work seems to be in the general template within wordpress 2.7.1.

    Doe someone know how to get it to work? It seems odd that this would be documented in two places in the wordpress documentation but doe not work?

    Has this code been implemented better in the to be released 2.8 ?

    any additional help out there?

    I am having the same trouble, using the exact code but keep getting this eror: “Parse error: syntax error, unexpected ‘<‘ in /home/content/d/e/a/dear429thyroid/html/wp-content/themes/republica/header.php on line 8”

    Line 8 being the first <?php for get_header

    <?php
    if (is_page('6')){
    	<?php get_header('header-headerabout'); ?>
    }
    elseif (is_page('1813')){
    	<?php get_header('header-headercontactus'); ?>
    }
    else {
    	<?php get_header('header-headerdefault'); ?>
    }
    ?>

    The install is the very latest version of WP and I just don’t see why it’s not working. Any help would be appreciated

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘name variable in get-header not working’ is closed to new replies.