嘿,我正在嘗試擴展WP_Customize_Control類,以在使用sage主題的Customizer中添加自定義帖子下拉。我甚至試圖在custom_register動作鉤子中添加類,但仍然沒有找到錯誤:試圖擴展WP_Customize_Control在sage主題中未發現錯誤
致命錯誤:在/ home/wpsitesb/sites/rex2/wp-home中找不到類'Roots \ Sage \ Customizer \ WP_Customize_Control'內容/主題/ REX-etyhadar_v1/lib中/上線36 customizer.php
我的代碼:
add_action('customize_register', __NAMESPACE__ . '\\customizer_register_callback');
function customizer_register_callback($wp_customize) {
class Post_Dropdown_Custom_Control extends WP_Customize_Control {
// Dropdown code.
}
}
謝謝,全球命名空間爲我工作 –