-1
我想在Wordpress主题定制器中扩展背景图像控件。我一直试图让这个代码的权利,现在,我想这应该是工作,我对这个函数接收一个意外T_Public:意外的T_Public功能。
public function tab_builtins() {
我试图去除掉它前面的公开声明,尽管这将创建一个新问题:意想不到的t_function
我一直在寻找这个代码很长一段时间试图改变小事情,但问题依然存在。谁能帮我吗?
这里是有问题的全码:
function WP_Customize_Background_Image_Control_Defaults($wp_customize) {
/* Substitute the default control for our new one */
$wp_customize->remove_control('background_image');
$wp_customize->add_control(new WP_Customize_Background_Image_Control_Defaults($wp_customize));
class WP_Customize_Background_Image_Control_Defaults extends WP_Customize_Background_Image_Control {
public function __construct($manager) {
$this->add_tab('builtins', __('Built-ins'), array($this, 'tab_builtins'));
public function tab_builtins() {
$backgrounds = array(
'/wp-content/themes/newtheme/img/backgrounds/background1.jpg', '/wp-content/themes/newtheme/img/backgrounds/background2.jpg', '/wp-content/themes/newtheme/img/backgrounds/background3.jpg', '/wp-content/themes/newtheme/img/backgrounds/background4.jpg', '/wp-content/themes/newtheme/img/backgrounds/background5.jpg'
);
if (empty($backgrounds))
return;
foreach ((array) $backgrounds as $background)
$this->print_tab_image(esc_url_raw($background->guid));
}
}
}
}
add_action('customize_register', 'wp_customize_background_image_control_defaults', 11, 1);
类的功能.. ?为什么你需要这样做? –
未正确关闭方法 – BlitZ