0

What I want to do is edit my footer for the front page of the site by making it bigger, but I want to keep it smaller for all the other pages.

My footer.php looks like this:

!-- BEGIN FOOTER TOP -->
    <div id="footer-top-wrapper">

        <div id="footer-top">

            <ul id="footer-navigation">
                <?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'footer-menu' ) ); ?>
            </ul>

            <div id="back-top">
                <a href="#">Back to top</a>
            </div>

        </div>

    </div>
    <!-- END FOOTER TOP -->

    <!-- BEGIN FOOTER -->
    <div id="footer-wrapper">

        <div id="footer">

            <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 1') ) ?>

            <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 2') ) ?>

            <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 3') ) ?>

            <?php   /* Widgetised Area */   if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Footer 4') ) ?>

        </div>

    </div>
    <!-- END FOOTER -->

    <!-- BEGIN FOOTER BOTTOM WRAPPER -->
    <div id="footer-bottom-wrapper">

        <!-- BEGIN FOOTER BOTTOM -->
        <div id="footer-bottom">

            <span class="footer-bottom-left"><?php echo get_option('lp_footer-text-left'); ?></span>
            <span class="footer-bottom-right"><?php echo get_option('lp_footer-text-right'); ?></span>

        </div>
        <!-- END FOOTER BOTTOM -->

    </div>
    <!-- END FOOTER BOTTOM WRAPPER -->

    <?php wp_footer(); ?>

    <?php $google_analytics = get_option('lp_google_analytics'); if ($google_analytics) { echo stripslashes($google_analytics); } ?>


</body>

</html>

Every page calls the footer using so how would I make it look one way in the front page, and another in all the other pages?

Site is http://www.botkai.com

1 Answer 1

1

You're looking for the is_home() and is_front_page() conditional tags

USe it like:

        <?php  if(is_home() || is_front_page()) : ?>
                <!-- Small footer on the home page, only has the #footer-navigation div -->
            <div id="footer-top">

                <ul id="footer-navigation">
                    <?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'footer-menu' ) ); ?>
        <?php  else : ?>
                <!-- Footer for the other pages also has the #back-top div -->
            <div id="footer-top">

            <ul id="footer-navigation">
                <?php wp_nav_menu( array( 'container' => false, 'theme_location' => 'footer-menu' ) ); ?>
            </ul>

            <div id="back-top">
                <a href="#">Back to top</a>
            </div>

        </div>
        <?php  endif; ?>
        ?>
5
  • I'm sorry can you show me an example? I'm just starting to learn this (the code above is from a theme I'm editing).
    – Brian
    Aug 6, 2012 at 1:44
  • Check the example. The part between the first and second PHP tags is only rendered on the home page. The part between the second and third PHP tags is rendered on any other pages.
    – moraleida
    Aug 6, 2012 at 1:55
  • Oh alright I understand. One last question. This goes in the footer.php file right?
    – Brian
    Aug 6, 2012 at 2:05
  • 1
    Yes. Same file. However, if changes are too large, you might just want to load different files, so instead of calling get_footer() on index.php and testing if it's the home page from inside the footer.php you can make a differente footer-home.php file and use get_footer('home'); whenever you want to call it.
    – moraleida
    Aug 6, 2012 at 2:09
  • Example: codex.wordpress.org/Function_Reference/…
    – moraleida
    Aug 6, 2012 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.