编辑一个页面的页脚,使其对其他页面保持相同

时间:2012-08-06 作者:Brian

我想做的是编辑网站首页的页脚,使其变大,但我想使其他所有页面的页脚变小。

我的页脚。php如下所示:

!-- 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>
每个页面都使用调用页脚,那么如何使其在头版和所有其他页面中分别显示?

网站是http://www.botkai.com

1 个回复
SO网友:moraleida

你在找is_home()is_front_page() 条件标记

使用方法如下:

        <?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; ?>
        ?>

结束