Support » Fixing WordPress » Problem using is_home

  • Resolved taghaboy

    (@taghaboy)


    Hi every one,

    I try with is_home and also with is_front_page to show the div “top_line” only in the home page. And in others pages the banner “top-ban-header”.

    BUT in every page in the website it always show the “top_line” not the banner !

    This is my code, what wrong :

    <?php if(!is_home()) { ?>
    	<div id="top-line"></div>
    <?php } else { ?>
    	<div id="top-ban-header"></div>
    <?php } ?>

    Thanks for the help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • try Reversing it.

    <?php if(is_home()) { ?>
    	<div id="top-ban-header"></div>
    <?php } else { ?>
    	<div id="top-line"></div>
    <?php } ?>

    Hope it will help.

    Thanks for ur reply,
    I’m sorry it dont work, really i dont know what happen !!!

    With this code it work so Good 🙂

    <?php if(is_front_page()){ ?>
    	  <div id="top-line"></div>
    <?php } else { ?>
    	  <div id="top-ban-header"></div>
    <?php } ?>

    My bad. I didn’t read the post well. the only wrong on your code is the not(!)…

    Oh well… you solve it. 🙂

    I just change your code (is home to is front page) so thank you 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem using is_home’ is closed to new replies.