在Wordpress中编辑'侧边栏'
问题描述:
我的wordpress页面上的东西似乎有问题,因为小部件没有显示,但我不确定如何编辑小部件。在Wordpress中编辑'侧边栏'
在外观下homepage.php代码>编辑器是
<section class="row post_content">
<div class="col-sm-8">
<?php the_content(); ?>
</div>
<?php get_sidebar('sidebar2'); // sidebar 2 ?>
</section> <!-- end article header -->
我会在哪里找到代码“sidebar2”作为在边栏应该显示
在页面上显示一条错误消息的那一刻
答
如开发人员手册get_sidebar()
所述,您的边栏文件应该被称为sidebar-sidebar2.php
。该文件将出现在活动主题的根目录中。
get_sidebar()
挂钩允许使用特定的侧边栏模板文件来代替默认侧边栏模板文件。如果你的文件被称为sidebar-new.php,你可以在hook中指定文件名为get_sidebar('new')。