我已经在下面设置了新的字段,有两种类型的图像和文本,我怎么能在一个php文件上调用它,我假设有一个函数。我能够访问theme> customize上的字段并向其添加数据,但现在我想粘贴到模板上。
$wp_customize->add_section('travel_video', array(
'priority' => 16,
'capability' => 'edit_theme_options',
'title' => __(' - Featured Videos', 'travel-lite'),
'description' => ''
));
$wp_customize->add_setting('travel[fpvideo]', array(
'default' => __('Title 1', 'travel-lite'),
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_textarea',
'type' => 'option'
));
$wp_customize->add_control('travel_fpvideo' , array(
'label' => __('Title 1', 'travel-lite'),
'section' => 'travel_video',
'settings' => 'travel[fpvideo]'
));
试试这段代码,可以查找参考自定义器
function mytheme_customize_register($wp_customize) {
$wp_customize->add_section('travel_video', array(
'priority' => 16,
'capability' => 'edit_theme_options',
'title' => __(' - Featured Videos', 'travel-lite'),
'description' => ''
));
$wp_customize->add_setting('travel[fpvideo]', array(
'default' => __('Title 1', 'travel-lite'),
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_textarea',
'type' => 'option'
));
$wp_customize->add_control('travel_fpvideo', array(
'label' => __('Title 1', 'travel-lite'),
'section' => 'travel_video',
'settings' => 'travel[fpvideo]'
));
}
add_action('customize_register', 'mytheme_customize_register');