2014-10-29 76 views
0

所以我有這樣一段代碼:

<?php 
    function mytheme_register_theme_customizer($wp_customizer){_ 

    $wp_customizer->add_section(
     'display_option' , 
     array(
      'title'  => 'Display Options', 
      'priority' => 200 

      ) 
    ); 

    $wp_customizer->add_setting(
      'index_background_image' , 
      array(
        'default' => '' , 
        'transport' => 'postMessage' 
       ) 

     ); 

    $wp_customizer->add_control(
     new WP_Customize_Image_Control(
      $wp_customizer, 
      'index_background_image', 
      array(

        'label'  => 'Background Image', 
        'section' => 'display_options', 
        'settings' => 'background_image' 
       ) 
      ) 
     ); 
} 
add_action('customize_register', 'mytheme_register_theme_customizer'); 

?> 

和所有我在瀏覽器中得到的結果是,在本地主機是:

在d語法錯誤,意外 '$ wp_customizer'(T_VARIABLE):解析錯誤\桌面V2 \ XAMPP \ htdocs中\可溼性粉劑內容\主題\上線重新\的functions.php 50

其中第50行是:

$wp_customizer->add_section(

可悲的是我看不到我的語法錯誤。

**我所有的目錄被列爲mytheme的*

回答

0

從該行的末尾刪除下劃線:

function mytheme_register_theme_customizer($wp_customizer){_ 

,使其成爲:

function mytheme_register_theme_customizer($wp_customizer){ 
+1

哦,我的上帝。這是紫色,所以我什至不能看到它。謝謝先生,祝你有美好的一天! – Andrew 2014-10-29 22:31:06

+0

不客氣:) – danmullen 2014-10-29 22:31:40