Support » Plugins » Hacks » If is homepage

  • Resolved stipto


    Hello there,

    Simple but unable to crack this one: How to display a few div’s only on the homepage? I’ve tried a lot of solutions, none worked for me.
    I’m doing this the header.php of the theme:

    <?php if( is_home() ) : ?>
    <div align="center">
    <div class="trigger"><h1><?php echo trigger($bowling); ?></h1><br /><h3>Wanna go bowling? Push the <a href="/bowling">Button</a></h3></div>
    <div class="cleardiv"></div>
    <?php endif;?>

    Doesn’t work… Anyone?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hej,

    works fine for me (apart from the trigger($bowling); obviously). What happens right now? Does it display on any/every page?

    is_home() works on your home page only if it is set to show your posts. If you have a static front page set, use is_front_page().


    I’m using is_front_page() now but it shows up on every page. Maybe because I put it in header.php? But that’s where I want it, above the body and below the menu…

    I solved it, put it in another php file and works fine now without the if statement.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘If is homepage’ is closed to new replies.