【问题标题】:Underscores Wordpress Theme - Adding second sidebar下划线 Wordpress 主题 - 添加第二个侧边栏
【发布时间】:2013-10-20 12:39:35
【问题描述】:

使用下划线主题 (_s) 关注 Wordpress 网站

我有一个侧边栏工作,但想在同一页面上制作第二个侧边栏。 (包含不同的小部件)

我已将新的边栏添加到 functions.php 中,它出现在 Wordpress 登录屏幕中,我可以将小部件放入其中。但是,我无法让它显示在实际网页上。 (第一个侧边栏工作正常)

任何人都知道如何做到这一点或知道教程...

谢谢

【问题讨论】:

    标签: php html wordpress themes sidebar


    【解决方案1】:

    您需要编辑主题文件夹中的“sidebar.php”文件。通常应该是:

    <div id="secondary" class="widget-area" role="complementary">
        <?php do_action( 'before_sidebar' ); ?>
    
        <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
        <?php endif; // end sidebar-1 widget area ?>
    
    </div><!-- #secondary -->
    

    您将需要添加另一个 if 语句来查找另一个侧边栏。请务必通过您在 functions.php 文件中使用的任何内容来引用它。

    如果您希望它显示在当前侧边栏下方,请务必在关闭“div”之前添加它,以便它仍然在同一列中。我使用了'sidebar-lower':

    <div id="secondary" class="widget-area" role="complementary">
        <?php do_action( 'before_sidebar' ); ?>
    
        <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
        <?php endif; // end sidebar-1 widget area ?>
    
        <?php if ( ! dynamic_sidebar( 'sidebar-lower' ) ) : ?>
        <?php endif; // end sidebar-lower widget area ?>
    
    </div><!-- #secondary -->
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-21
      • 1970-01-01
      • 1970-01-01
      • 2014-02-07
      • 2013-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多