WordPress.org

Ready to get started?Download WordPress

Forums

Different footer for home page (7 posts)

  1. TobyH
    Member
    Posted 1 year ago #

    I know this topic has been covered extensively, but I can't seem to make it work. I am using the twenty eleven theme (reconfigured obviously).

    I want to make a different footer for the home page:

    http://www.meagansegal.com

    All I want to do is remove the "home" button on the left for the home page. I created a new footer called "footer-home.php" and removed the link in question.

    Here is what I put into the index.php page:

    <?php
    if ( is_home() ) :
    get_footer('home');
    else :
    get_footer();
    endif;
    ?>

    Where am I going wrong? Any help would be greatly appreciated.

  2. Max
    Member
    Posted 1 year ago #

    Well, it may be that the page you are using for your front page may not actually be "home", so just substitute is_home() with is_front_page() if you set a static front page in the backend.

    I would say though, just as an aside, that a simpler method would be to just to wrap te home list item with the if statement above in your footer.php file, then you don't need an additional footer-home.php file.

  3. TobyH
    Member
    Posted 1 year ago #

    I like the second option much better!

    So you're saying if I put inside the list item like so:

    <li class="homeNav" ?php
    if ( is_home() ) :
    get_footer('home');
    else :
    get_footer();
    endif;
    ?>

    That would work?

  4. alchymyth
    Forum Moderator
    Posted 1 year ago #

    try to utilize the body_class() output of the home page .home to hide the 'home' nav tab on the home page:

    .home #navBottom .homeNav {display:none;}
  5. Max
    Member
    Posted 1 year ago #

    @alchymyth Oh yes -- so simple -- :-)

  6. TobyH
    Member
    Posted 1 year ago #

    Worked perfectly!! Thank you so much!!! Lovin WordPress...

  7. michael.mariart
    Member
    Posted 1 year ago #

    I'd be careful hiding things like this using CSS. The main reason not ot is that the Google still sees your source code and knows that there's a menu there with a lot of links in it, but it's hidden from users. In their eyes, this can be considered "cloaking" and can penalise your site in search rankings. This might not be a big concern for you, but it's something to remember.

    Your PHP function was almost there to make this work. The only thing that I would tell you to change is to have is_front_page() instead of is_home(). I know this sounds a bit silly, but I've been caught with this a few times before.

Topic Closed

This topic has been closed to new replies.

About this Topic