• melie

    (@melie)


    I have a popover on this WP site. Because the javascript had to be loaded into the header.php and footer.php files it now shows up on every page.

    Is there a way to apply a conditional tag so that it only shows on the ‘home’ page?

    Or is there some way to create custom header and footer files to be called up only on the home page template? I tried to do that but that page ended up not loading… saying that fuction had not been defined. So, I set it back to get the original header and footer.

    http://www.take10now.com

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Yes to both 🙂

    There are conditional tags out the wazoo for WP: http://codex.wordpress.org/Conditional_Tags

    Unless you need a VASTLY different, you’re probably better off using the tags than trying to make a totally different header and footer for the pages.

    <?php
    if (is_home())
    {?>
    Your Javascript Goes Here
    <?php } ?>
    Thread Starter melie

    (@melie)

    Thanks so much! However, in this case the ‘home’ or front page uses a page template called intro.php. When I tried to change it to use intro instead of home I get this…

    Fatal error: Call to undefined function is_intro() in …/themes/modernpaper-10/header.php on line 6

    Is there a way to define a function for my intro.php template?
    or some other way to use this?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Well there is no ‘is_intro()’ so that’ll never work.

    Is your front page using the static front page feature? If so, use is_front_page() (That’s mentioned, BTW, in the doc I linked to. Hint hint 😉 )

    I think there’s an alternate way with is_page(name) as well. Go read the codex link and see which one suites your setup 🙂

    Thread Starter melie

    (@melie)

    is_front_page() did the trick! Right, I should have read that page!! :))

    Thank you so very much!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘custom header for one page?’ is closed to new replies.