0

嘿,我正在尝试在 wordpress 主题中添加一个自定义选项,该选项允许用户在展示中上传自己的图像,但我在 custom.php 文件中遇到语法错误。任何人都可以帮助我以正确的方式写这个吗?谢谢!

解析错误:语法错误,第 13 行 /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/themes/wpbootstrap/inc/customizer.php 中的意外 '=>' (T_DOUBLE_ARROW)

        $wp_customize->add_setting('showcase_image', array(

        'default' => get_bloginfo('template_directory').'/img/showcase.jpg', 'wpbootstrap'),
    line 13 'type' => 'theme_mod'
        ));
4

1 回答 1

3

不用勺子喂答案(如上面@community 的要求),而是提供一种可重复使用的技术来查找这些类型的错误......

临时重新格式化您的代码,以便所有函数参数和/或数组元素都在自己的行上并适当地使用标识。最终你可能会看到一些不是你想要的东西。下面的例子(你快到了)。

$wp_customize->add_setting(
    'showcase_image',    // func parm
    array(   
        'default' => get_bloginfo(
                'template_directory'
            ).'/img/showcase.jpg',
        'wpbootstrap'
    ),
    'type' => 'theme_mod'
)
);
于 2017-08-11T00:53:55.087 回答