2010-08-30 40 views
0

我很難爲我的Wordpress主題設置第二個側邊欄。添加第二個Wordpress部件

下面是function.php代碼:

<?php 
if(function_exists('register_sidebar')){ 
    register_sidebar(array(
     'before_widget'=>'<li>', 
     'after_widget'=>'</li>', 
     'before_title'=>'<h2>', 
     'after_title'=>'</h2>', 
    )) 
; 
} 
?> 
<?php 
if(function_exists('register_sidebar')){ 
    register_sidebar('home'array(
     'before_widget'=>'<li>', 
     'after_widget'=>'</li>', 
     'before_title'=>'<h2>', 
     'after_title'=>'</h2>', 
    )) 
; 
} 
?> 

這是當我嘗試訪問控件選項頁中管理我收到的錯誤:

Parse error: syntax error, unexpected T_ARRAY in C:\xampp\htdocs\tlc\wp-content\themes\tlc\functions.php on line 14

+0

有一個蠕蟲堆棧交換網站,你應該看看。 – Sruly 2010-08-30 18:25:27

回答

3

給它一個名使用此語法

register_sidebar(array(
    'name' => 'RightSideBar', 
    'description' => 'Widgets in this area will be shown on the right-hand side.', 
    'before_title' => '<h1>', 
    'after_title' => '</h1>' 
)); 

你寫的不是

查看更多信息 http://codex.wordpress.org/Function_Reference/register_sidebar

+0

非常感謝。 – 2010-08-30 18:39:55