douzi9744 2014-04-11 15:45
浏览 190
已采纳

Wordpress页脚不显示在常规页面上...仅限主页

Ok, so I'm customizing a wordpress theme and have not been able to understand why the footer widgets are not displaying on regular pages...

Here's the footer.php code:

</div><!--.container_12-->
</div><!--.container-->
</div>  
    <footer id="footer">
        <?php if (is_front_page()) : ?>
        <div id="widget-footer">
        <div class="container_12 clearfix">
        <?php if ( ! dynamic_sidebar( 'Footer' ) ) : ?>
          <!--Widgetized Footer-->
        <?php endif; ?>
    </div>
      </div>
        <?php endif; ?>
        <div id="copyright" class="clearfix">
        <div class="container_12 clearfix">
                <div class="grid_12">

                    <div id="back-top-wrapper">
        <p id="back-top">
        <a href="#top"><span></span><span class="hover"></span></a>
      </p>
    </div>

                    <div id="footer-text">
                        <?php $myfooter_text = of_get_option('footer_text'); ?>

                        <?php if($myfooter_text){?>
                            <?php echo of_get_option('footer_text'); ?>
                        <?php } else { ?>
                            <a href="<?php bloginfo('url'); ?>/" title="<?php bloginfo('description'); ?>" class="site-name"><?php bloginfo('name'); ?></a> <?php _e('is proudly powered by', 'theme1837'); ?> <a href="http://wordpress.org">WordPress</a> <a href="<?php if ( of_get_option('feed_url') != '' ) { echo of_get_option('feed_url'); } else bloginfo('rss2_url'); ?>" rel="nofollow" title="<?php _e('Entries (RSS)', 'theme1837'); ?>"><?php _e('Entries (RSS)', 'theme1837'); ?></a> and <a href="<?php bloginfo('comments_rss2_url'); ?>" rel="nofollow"><?php _e('Comments (RSS)', 'theme1837'); ?></a>
                        <?php } ?>
                        <br />
                        <?php if( is_front_page() ) { ?>
                        <!-- {%FOOTER_LINK} -->
                        <?php } ?>
                    </div>

                </div>
            </div>
        </div><!--.container-->
    </footer>
</div><!--#main-->
<?php wp_footer(); ?> <!-- this is used by many Wordpress features and for plugins to work properly -->
<?php if(of_get_option('ga_code')) { ?>
    <script type="text/javascript">
        <?php echo stripslashes(of_get_option('ga_code')); ?>
    </script>
  <!-- Show Google Analytics -->    
<?php } ?>
</body>
</html>

Here's the homepage code where the footer widgets "are" displaying properly:

<?php
/**
 * Template Name: Home Page
 */

get_header(); ?>
<div class="clearfix">
  <div class="grid_3">
    <div class="left-column">
      <?php if ( ! dynamic_sidebar( 'Left Home Area' ) ) : ?><!-- Wigitized Home --><?php endif ?>
    </div>
  </div>
  <div class="grid_9">
    <?php if( is_front_page() ) { ?>
      <section id="slider-wrapper">
        <?php include_once(TEMPLATEPATH . '/slider.php'); ?>
      </section><!--#slider-->
    <?php } ?>

    <div class="row">
      <?php if ( ! dynamic_sidebar( 'Right Home Area #1' ) ) : ?><!-- Wigitized Home --><?php endif ?>
    </div>

    <div class="row-1">
      <?php if ( ! dynamic_sidebar( 'Right Home Area #2' ) ) : ?><!-- Wigitized Home --><?php endif ?>
    </div>

  </div>
</div>
<?php get_footer(); ?>

and here's the normal page code where footer widgets are "NOT" displaying as intended:

<?php get_header(); ?>

<div id="content" class="grid_9 <?php echo of_get_option('blog_sidebar_pos') ?>">
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class('page'); ?>>
      <article class="post-holder">
        <div class="header-title">
        <h1><?php the_title(); ?></h1>
    </div>
        <?php if(has_post_thumbnail()) {
                    echo '<a href="'; the_permalink(); echo '">';
                    echo '<figure class="featured-thumbnail"><span class="img-wrap">'; the_post_thumbnail(); echo '</span></figure>';
                    echo '</a>';
                    }
                ?>
        <div id="page-content">
          <?php the_content(); ?>
          <div class="pagination">
            <?php wp_link_pages('before=<div class="pagination">&after=</div>'); ?>
          </div><!--.pagination-->
        </div><!--#pageContent -->
      </article>
    </div><!--#post-# .post-->

  <?php endwhile; ?>
</div><!--#content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Any ideas?

  • 写回答

1条回答 默认 最新

  • dtdh11647 2014-04-11 15:49
    关注

    Your footer widgets are included inside an if statement that uses is_front_page()

        <?php if (is_front_page()) : ?>
            <div id="widget-footer">
                <div class="container_12 clearfix">
                    <?php if ( ! dynamic_sidebar( 'Footer' ) ) : ?>
                        <!--Widgetized Footer-->
                    <?php endif; ?>
                </div>
            </div>
        <?php endif; ?>
    

    This will only enter this conditional branch if on the blog index.

    If you need to extend this statement, other such checks include is_single(), is_category(), is_tax(), etc.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料