【问题标题】:Proper way to call a second sidebar in main page wordpress?在主页wordpress中调用第二个侧边栏的正确方法?
【发布时间】:2014-05-20 12:01:51
【问题描述】:

我决定开始一个新问题。来自前人one 的信息,因为我认为我没有抓住重点。

我正在尝试在我正在设计的博客的主主页中(同时)拥有 2 个侧边栏。目前我已经实现了它,但是以一种混乱的方式......

我(认为)我注册了两个侧边栏,为它们制作了 html 代码并在 Css 中设置了样式。 但是我对php的了解太少了,以至于我无法知道在主页面中边栏是如何被调用的。我知道应该使用get_sidebar,但它只在代码中出现一次,并且作为一个函数本身出现。

<?php if ((!in_the_loop() && Bunyad::posts()->meta('layout_style') == 'full') OR Bunyad::core()->get_sidebar() == 'none'): // largest images - no sidebar? ?>

(我认为这个 Bunyad 插件有部分责任......以前有人遇到过问题吗?)

所以我只是将第二个侧边栏的 html 代码粘贴到我想要的位置。

   <div class="row">
  <div class="col-6 main-content">(...)</div>

<?php Bunyad::core()->theme_sidebar(); ?>  <!--I think this calls the first sidebar-->

<aside class="col-2 sidebar2"> <!--this is a copy of the code for the first sidebar that can be found in a separate file called sidebar.php -->
    <ul>

    <?php if (!dynamic_sidebar('cs-sidebar_publicidad')) : ?>
        <?php _e("<li>Nothing yet.</li>", 'bunyad'); ?>
    <?php endif; ?>

    </ul>
</aside>

</div> <!-- .row -->

cs-sidebar_publicidad是第二个侧边栏的 ID,我在 WP 管理面板中创建的...)

任何帮助都受到广泛赞赏,在此先感谢!

【问题讨论】:

    标签: php html wordpress sidebar


    【解决方案1】:

    在 wp 页面中添加侧边栏或块

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-21
      • 2013-10-20
      • 1970-01-01
      • 2013-12-28
      • 2015-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多