更改侧栏小工具的名称

时间:2010-10-18 作者:Jeff Tancil

我创建了动态侧栏。它们工作正常,出现在窗口小部件区域。

但是,我想自定义显示在每个侧边栏上的名称。

所以,现在每个边栏都被命名为“边栏1”、“边栏2”,等等。

相反,我希望他们说一些类似“关于侧栏”、“工具箱侧栏”的话。

这不是标题(该字段为空,用户可以随意输入任何文本)。

谢谢你的帮助!杰夫

我不知道该怎么做。

2 个回复
最合适的回答,由SO网友:sorich87 整理而成

在register\\u提要栏调用中使用“Name”参数。E、 例如,请参阅默认的二十个十主题中的以下代码,第351行。

function twentyten_widgets_init() {
    // Area 1, located at the top of the sidebar.
    register_sidebar( array(
        \'name\' => __( \'Primary Widget Area\', \'twentyten\' ),
        \'id\' => \'primary-widget-area\',
        \'description\' => __( \'The primary widget area\', \'twentyten\' ),
        \'before_widget\' => \'<li id="%1$s" class="widget-container %2$s">\',
        \'after_widget\' => \'</li>\',
        \'before_title\' => \'<h3 class="widget-title">\',
        \'after_title\' => \'</h3>\',
    ) );

    // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
    register_sidebar( array(
        \'name\' => __( \'Secondary Widget Area\', \'twentyten\' ),
        \'id\' => \'secondary-widget-area\',
        \'description\' => __( \'The secondary widget area\', \'twentyten\' ),
        \'before_widget\' => \'<li id="%1$s" class="widget-container %2$s">\',
        \'after_widget\' => \'</li>\',
        \'before_title\' => \'<h3 class="widget-title">\',
        \'after_title\' => \'</h3>\',
    ) );

    // Area 3, located in the footer. Empty by default.
    register_sidebar( array(
        \'name\' => __( \'First Footer Widget Area\', \'twentyten\' ),
        \'id\' => \'first-footer-widget-area\',
        \'description\' => __( \'The first footer widget area\', \'twentyten\' ),
        \'before_widget\' => \'<li id="%1$s" class="widget-container %2$s">\',
        \'after_widget\' => \'</li>\',
        \'before_title\' => \'<h3 class="widget-title">\',
        \'after_title\' => \'</h3>\',
    ) );

    // Area 4, located in the footer. Empty by default.
    register_sidebar( array(
        \'name\' => __( \'Second Footer Widget Area\', \'twentyten\' ),
        \'id\' => \'second-footer-widget-area\',
        \'description\' => __( \'The second footer widget area\', \'twentyten\' ),
        \'before_widget\' => \'<li id="%1$s" class="widget-container %2$s">\',
        \'after_widget\' => \'</li>\',
        \'before_title\' => \'<h3 class="widget-title">\',
        \'after_title\' => \'</h3>\',
    ) );

    // Area 5, located in the footer. Empty by default.
    register_sidebar( array(
        \'name\' => __( \'Third Footer Widget Area\', \'twentyten\' ),
        \'id\' => \'third-footer-widget-area\',
        \'description\' => __( \'The third footer widget area\', \'twentyten\' ),
        \'before_widget\' => \'<li id="%1$s" class="widget-container %2$s">\',
        \'after_widget\' => \'</li>\',
        \'before_title\' => \'<h3 class="widget-title">\',
        \'after_title\' => \'</h3>\',
    ) );

    // Area 6, located in the footer. Empty by default.
    register_sidebar( array(
        \'name\' => __( \'Fourth Footer Widget Area\', \'twentyten\' ),
        \'id\' => \'fourth-footer-widget-area\',
        \'description\' => __( \'The fourth footer widget area\', \'twentyten\' ),
        \'before_widget\' => \'<li id="%1$s" class="widget-container %2$s">\',
        \'after_widget\' => \'</li>\',
        \'before_title\' => \'<h3 class="widget-title">\',
        \'after_title\' => \'</h3>\',
    ) );
}
/** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
add_action( \'widgets_init\', \'twentyten_widgets_init\' );

SO网友:Bogar

最简单的方法是;外观/侧栏,在右侧添加新侧栏,键入名称,单击添加侧栏。添加任意数量的小部件,然后将小部件添加到外观/小部件部分的这些侧栏中。

结束

相关推荐

Sidebar slideshow widget

有人知道可以放在边栏上的高质量图像幻灯片小部件吗?