• lowendtheory

    (@lowendtheory)


    I’m wanting to have a site that the header for each page has a different image. I’ve seen some plugins for it that look quite promising but a few of the pages also need to display a video player in the header as well. (different videos on each page too)

    Does anyone have any ideas of the best way to do this? Are there any themes currently out there that already have this functionality?

    The site needs to function like http://www.askmitchnow.com, as this is our current site.

Viewing 1 replies (of 1 total)
  • Marventus

    (@marventus)

    Hello there,

    The way I would accomplish this would be through a multiple if statement using php, and the implementation would depend on the level of difference between each heeader:
    1. If you only need to change the picture or the video on the header based on what page you are on and only that, you could add a multiple if statement in your header.php file that would change the image/video div ID based on what page you are on, and then have different css styles defined for each ID, like so:
    PHP:

    <?php if (is_home()) { ?> <!– Change to "is_front_page" if you do not use your home as your front page –>
    <div id=”header_home”> <!– If Home/FP, assign Home/FP ID to header –>
    <?php } else { ?>
    <div id=”<?php echo $post->post_name; ?>”> <!– Uses the page title to generate an ID for your header –>
    <?php } ?>

    And so on. Don’t forget to close your div tag after all this (you can insert the closing </div> in the code as well.

    CSS:

    #header_home {
        background: url(<template_path>/images/pic_for_home.jpg) no-repeat;
        <other parameters> }
    #page_name_1 {
        background: url(<template_path>/images/pic_for_page_1.jpg) no-repeat;
       <other parameters> }

    2. If you need to change more than just the image/video, then I suggest you create different header.php files and use conditional tags to load each one based on what page the user is on. The most elegant way to go about this would be to add this code as a function in your functions.php file.

    LMK if this helps or if you need more assistance. Take care!

    P.S.: I almost forgot to mention there’s a very similar thread to this one that might help you. They implemented the second solution, which now that I think about it, might be more helpful to you because with he first option I gave you, as far as I know, you would not be able to load videos or flash movies from the css file.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom page headers with video’ is closed to new replies.