在主页wordpress中调用第二个侧边栏的正确方法?

时间:2014-05-20 03:14:12

标签: php html wordpress sidebar

我决定开始一个新问题。来自先前one的信息,因为我认为我错过了重点。

我正在尝试在我正在设计的博客的主要家中有两个侧边栏(同时)。现在我已经实现了它,但是以凌乱的方式......

我(想)我注册了两个侧边栏,为两者制作了html代码,并在Css中设置了两种风格。 但我对PHP的了解很少,以至于我无法知道如何在maing页面中调用侧边栏。我知道应该使用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管理面板中创建的...)

任何帮助都会受到广泛赞赏,提前谢谢!

1 个答案:

答案 0 :(得分:1)

在wp页面中添加侧栏或块