how do I create a home page footer.php
-
I’d like my footer on my Home page to be different than the footer for all other pages. (When I edit the footer.php file, the changes go to all the pages.) That said, I suppose I will need to create a “footer-home.php” kind of page. Since I’m not proficient in PHP, I’m wondering if there’s a step-by-step instruction out there.
Thanks so very much!
-
Hi Esmi. Thanks for the link and quickness. I’m new at WP, so I’m having some trouble getting the configurations to work. Do you have a moment to check my work? Here’s what I did…
I created a new file: “footer-home.php” (duplicated from “footer.php”), and added in the desired change. I uploaded it to my (child’s) theme.
In the template’s “page.php” file I replaced this code:
<?php get_footer(); ?>with this code:
<?php if ( is_home() ) : get_footer('home'); elseif ( is_404() ) : get_footer('404'); else : get_footer(); endif; ?>The non-home pages are showing the footer.php stuff, but the Home page is also viewing the footer.php stuff as well. (No difference.)
I tried the above code in the home.php file as well, but that didn’t work either.
Was I supposed to do something else (like in the functions.php file?)Thank you for your time (and patience).
Try:
if ( is_home() || is_front_page() ) :Two questions. Where do I apply the code. And this last bit of code you’ve offered, is that by itself or part of the earlier code? (I’m not very competent in php.)
It’s a replacement for
if ( is_home() ) :in the code you quoted above.Yes, esmi, that worked. Thank you for your time. For others, here’s what I did (with Esmi’s help):
I duplicated footer.php to footer-home.php. The first one dictates the footer for all pages, the second one only for the home page.
In my page.php file (in my themes > child) I replaced:
<?php get_footer(); ?>
with<?php if ( is_home() || is_front_page() ) : get_footer('home'); elseif ( is_404() ) : get_footer('404'); else : get_footer(); endif; ?>Now I have 2 versions of working footers.
The topic ‘how do I create a home page footer.php’ is closed to new replies.