2014-10-29 82 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