三个不带呼叫的侧边栏

时间:2015-05-28 作者:Piyush Rawat

调用标题侧栏的模板中的代码

<div class="wrapper">
<?php get_sidebar("header"); ?>
<div id="switcher">
小部件。php有以下代码。。。

 <?php
if (function_exists(\'register_sidebar\')) {

register_sidebar(array(
    \'name\' => \'Header\',
    \'id\'   => \'header\',
    \'description\'   => \'This is the widgetized header.\',
    \'before_widget\' => \'<div id="%1$s" class="widget %2$s">\',
    \'after_widget\'  => \'</div>\',
    \'before_title\'  => \'<h4>\',
    \'after_title\'   => \'</h4>\'
));
register_sidebar(array(
    \'name\' => \'Sidebar\',
    \'id\'   => \'sidebar\',
    \'description\'   => \'This is the widgetized sidebar.\',
    \'before_widget\' => \'<div id="%1$s" class="widget %2$s">\',
    \'after_widget\'  => \'</div>\',
    \'before_title\'  => \'<h4>\',
    \'after_title\'   => \'</h4>\'
));
register_sidebar(array(
    \'name\' => \'Footer\',
    \'id\'   => \'footer\',
    \'description\'   => \'This is the widgetized footer.\',
    \'before_widget\' => \'<div id="%1$s" class="widget %2$s">\',
    \'after_widget\'  => \'</div>\',
    \'before_title\'  => \'<h4>\',
    \'after_title\'   => \'</h4>\'
));

}

1 个回复
最合适的回答,由SO网友:Piyush Rawat 整理而成

我使用的是get\\u sidebar()而不是dynamic\\u sidebar(\'name\')。。。。

结束

相关推荐

“Sidebar”模板中包含评论计数的最近帖子

我试过这个代码,但它完全破坏了我的网站。我想这是因为我在侧栏模板中WP\\u查询的神圣帖子上下文中做错了什么。请一些WP专家更正此代码好吗?<?php $args = array( \'orderby\' => \'date\' ,\'order\' => \'DESC\' ,\'showposts\'=>6 ); $my_query = new WP_Query($args);