我正在学习如何在WordPress中创建徽标上传器,以便我可以使用自定义程序将自己的徽标上传到我的WordPress网站。
警告:call_user_func_array()期望参数1是有效的回调,函数'wpt_register_theme_customizer'未找到或/ Users / brandonpowell / sites / valet / wordpress-development / web / wp / wp-includes / class中的函数名无效第298行-wp-hook.php
我正在运行以发布每个教程和博客文章如何创建徽标上传我每次都遇到相同的错误消息。有人可以向我解释创建徽标上传器的最佳方法。
function wpt_register_theme_customizer( $wp_customize ) {
// Add Custom Logo Settings
$wp_customize->add_section( 'custom_logo' , array(
'title' => __('Change Your Logo','wptthemecustomizer'),
'panel' => 'design_settings',
'priority' => 20
) );
$wp_customize->add_setting(
'wpt_logo',
array(
'default' => get_template_directory_uri() . '/images/logo.png',
'transport' => 'postMessage'
)
);
$wp_customize->add_control(
new My_Customize_Image_Reloaded_Control(
$wp_customize,
'custom_logo',
array(
'label' => __( 'Change Logo', 'wptthemecustomizer' ),
'section' => 'custom_logo',
'settings' => 'wpt_logo',
'context' => 'wpt-custom-logo'
)
)
);
}
add_action( 'customize_register', 'wpt_register_theme_customizer' );
答案 0 :(得分:1)
您在此文件中使用namespace
吗?如果需要,您需要在函数名称中包含命名空间,如下所示:
add_action( 'customize_register', __NAMESPACE__ . '\\wpt_register_theme_customizer' );