我試圖在Wordpress定製器中添加一個額外的設置。您是否可以在網站標題&標語部分中添加額外設置,或者您是否必須創建自己的部分?這是代碼我到目前爲止在我functions.php文件:在wordpress中向定製器添加設置時發生致命錯誤
function mytheme_customize_register($wp_customize)
{
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'your_setting_id',
array(
'label' => __('Your Label Name', 'theme_name'),
'section' => 'title_tagline',
'settings' => 'your_setting_id',
'type' => 'text'
)
)
);
}
add_action('customize_register', 'mytheme_customize_register');
如果我試圖去定義主題頁面在管理方面,雖然我得到以下錯誤:
Fatal error: Call to a member function check_capabilities() on a non-object in C:\xampp\htdocs\one-gas\wp-includes\class-wp-customize-control.php on line 161
您好,首先感謝試圖幫助。我試過了你的代碼,但是得到一個錯誤(查看更新後的問題) – geoffs3310
你需要改變通用信息,比如setting_id和theme_name。這就是爲什麼它不起作用。 – michaelrmcneill