2017-04-11 75 views
0

我想通過WordPress中的定製器設置一個簡單的頭。我是PHP和WP開發人員的新手。WordPress定製器錯誤:調用成員函數add_setting()對未知

這裏是我的functions.php:

//add contact_info_header customizer 
function wpl_customize_register($wp_register) { 
//ALL sections, settings and controls will be added 
$wp_customizer->add_setting('contact_header', array(
    'default' => 'Giver Uforpligtende Tilbud', 
    'transport' => 'refresh' 
    )); 


$wp_customize->add_control(
    new WP_Customize_Text_Control($wp_customize, 'Contact Heading', array(
     'label'  => __('Contact Heading', 'lorrix_one_lite_child'), 
     'section' => 'llorix_one_lite_contact_section', 
     'settings' => 'contact_header', 
     'type'  => 'text' 
     ))); 

$wp_customize->get_section ('llorix_one_lite_contact_section')->transport = 'refresh'; 
} 
add_action('customize_register', 'wpl_customize_register'); 

我的錯誤代碼。

「致命錯誤:accesing前端定製時,我精心得到這個未捕獲的錯誤:調用一個成員函數add_setting()上 未知在C:\ XAMPP \ htdocs中\ localwp.com \可溼性粉劑內容\主題\ llorix-one-lite-child \ functions.php:20堆棧跟蹤:#0 C:\ xampp \ htdocs \ localwp.com \ wp-includes \ class-wp-hook.php(298):wpl_customize_register(Object WP_Hook-> apply_filters(NULL,Array)#2 C:\ xampp \ htdocs \ localwp(WP_Customize_Manager))#1 C:\ xampp \ htdocs \ localwp.com \ wp-includes \ class-wp-hook.php .com \ wp-includes \ plugin.php(453):WP_Hook-> do_action(Array)#3 C:\ xampp \ htdocs \ localwp.com \ wp-includes \ class-wp-customize-manager.php(734) :do_action('customize_regis ...',Object(WP_Customize_Manager))#4 C:\ xampp \ htdocs \ localwp.com \ wp-includes \ class-wp-hook.php(298):WP_Customize_Manager-> wp_loaded('' )#5 C:\ xampp \ htdocs \ localwp.com \ wp-includes \ class-wp-ho OK.php(323):WP_Hook-> apply_filters(NULL,Array)#6 C:\ xampp \ htdocs \ localwp.com \ wp-includes \ plugin.php(453):WP_Hook-> do_action(Array)#7 C :\ xampp \ htdocs \ localwp.com \ wp-settings.php(470):do_action('wp_loaded')#8 C:\ xampp \ htdocs \ localwp.com \ wp-con在C:\ xampp \ htdocs \ localwp .com \ wp-content \ themes \ llorix-one-lite-child \ functions.php on line 20「

對我來說,它看起來像調用$ wp_customize對象上的add_setting()有問題嗎?

謝謝大家的閱讀和回答。

回答

0

解決了它。有一個unneccesarry函數纏繞HTML我試圖編輯...哎呀

相關問題