Support » Fixing WordPress » Different headers coding.

  • techbunny


    Hi guy’s,

    I’ve been trying to develop a wordpress template to use different header images on each page. I have found several closed topics which have been helpful but I’m at a sticking point where I think the code is correct but the images are not displaying.

    The topic I have used for reference is:

    The coding I have placed into my Main Index Template.php is:

    get_header(); ?>
    <?php if (is_home()) get_header(); ?>
    <?php if (is_page(wh-casino()) include(get_template_directory() . ''); ?>

    I’m wondering if using the page name (wh-casino) or the image url is what’s causing the code to fail, please can someone point me in the right direction?

    Thanks 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Andrew Nevins


    Forum moderator

    This is generating an invalid URL

    include(get_template_directory() . '<em></em>');

    It’s outputting something like this


    Perhaps you just want either this;

    include(get_template_directory() . 'uploads/2012/12/Sturgeons-078.jpeg');



    You shouldn’t have HTML elements in include functions.



    Hi Andrew,

    I was literally just editing my post because the italics tags were to highlight the two areas I think were causing problems but they are not present in my code.

    I will try your suggestions, thank you for a fast response 🙂


    Edit: Both of Andrew’s options are not changing the header for me. The page I wish to change a header image on is renamed to: wh-casino so I have updated my coding to display the page name as wh-casino instead of 8 as my initial post states.

    In my Main Index Template (index.php) I have placed the codes in as follows:

     * @package WordPress
     * @subpackage Default_Theme
    <?php if (is_home()) get_header(); ?>
    <?php if (is_page(wh-casino()) include(get_template_directory() . 'uploads/2012/12/Sturgeons-078.jpeg'); ?>
    get_header(); ?>

    Can anyone else advise?

    Moderator Andrew Nevins


    Forum moderator

    What happens if you add a forward slash before uploads?


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Different headers coding.’ is closed to new replies.