我试图对《二十一世纪主题》(wordpress 3.4.2)中的一个函数做一个小改动
我收到以下错误消息:
Fatal error: Cannot redeclare twentyeleven_widgets_init() (previously declared in /home/labfocus/public_html/wp-content/themes/twentyeleven-child/functions.php:10) in /home/labfocus/public_html/wp-content/themes/twentyeleven/functions.php on line 438
下面是我试图添加的函数,以代替原来的
<?php
if ( !function_exists(\'twentyeleven_widgets_init\')) {
/**
* Register our sidebars and widgetized areas. Also register the default Ephemera widget.
*
* @since Twenty Eleven 1.0
*/
function twentyeleven_widgets_init() {
register_widget( \'Twenty_Eleven_Ephemera_Widget\' );
register_sidebar( array(
\'name\' => __( \'Main Sidebar\', \'twentyeleven\' ),
\'id\' => \'sidebar-1\',
\'before_widget\' => \'<div class="su-spoiler-title">%2$s</div><aside id="%1$s" class="widget %2$s">\',
\'after_widget\' => "</aside></div>",
\'before_title\' => \'<h3 class="widget-title">\',
\'after_title\' => \'</h3>\',
) );
register_sidebar( array(
\'name\' => __( \'Showcase Sidebar\', \'twentyeleven\' ),
\'id\' => \'sidebar-2\',
\'description\' => __( \'The sidebar for the optional Showcase Template\', \'twentyeleven\' ),
\'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
\'after_widget\' => "</aside>",
\'before_title\' => \'<h3 class="widget-title">\',
\'after_title\' => \'</h3>\',
) );
register_sidebar( array(
\'name\' => __( \'Footer Area One\', \'twentyeleven\' ),
\'id\' => \'sidebar-3\',
\'description\' => __( \'An optional widget area for your site footer\', \'twentyeleven\' ),
\'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
\'after_widget\' => "</aside>",
\'before_title\' => \'<h3 class="widget-title">\',
\'after_title\' => \'</h3>\',
) );
register_sidebar( array(
\'name\' => __( \'Footer Area Two\', \'twentyeleven\' ),
\'id\' => \'sidebar-4\',
\'description\' => __( \'An optional widget area for your site footer\', \'twentyeleven\' ),
\'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
\'after_widget\' => "</aside>",
\'before_title\' => \'<h3 class="widget-title">\',
\'after_title\' => \'</h3>\',
) );
register_sidebar( array(
\'name\' => __( \'Footer Area Three\', \'twentyeleven\' ),
\'id\' => \'sidebar-5\',
\'description\' => __( \'An optional widget area for your site footer\', \'twentyeleven\' ),
\'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
\'after_widget\' => "</aside>",
\'before_title\' => \'<h3 class="widget-title">\',
\'after_title\' => \'</h3>\',
) );
}
}
有人能看到这个函数有什么问题吗?
Update: 问题是我真的想改变Main Sidebar
显示器before_widget
和after_widget
. 我添加了一个<div>