我有一个WP模板,使用functions.php
中的以下内容设置标题图像add_theme_support( 'custom-header' );
$defaults = array(
'default-image' => get_template_directory_uri() . '/images/100.png',
'width' => 1100,
'height' => 500,
);
add_theme_support( 'custom-header', $defaults );
我希望能够在标题中设置2个图像并通过admin appearance->标题菜单更新这些图像,这可能吗?任何对此文档的引用都会有所帮助,因为我找不到任何文档。
如果我添加以下内容,两者都在一个部分下,无论如何都要分割它们:
function example_customizer( $wp_customize ) {
$wp_customize->add_section(
'example_section_one',
array(
'title' => 'Example Settings',
'description' => 'This is a settings section.',
'priority' => 35,
)
);
$wp_customize->add_setting(
'copyright_textbox',
array(
'default' => 'Default copyright text',
)
);
$wp_customize->add_control(
'copyright_textbox',
array(
'label' => 'Copyright text',
'section' => 'example_section_one',
'type' => 'text',
)
);
}
add_action( 'customize_register', 'example_customizer' );
function example_customizer1( $wp_customize ) {
$wp_customize->add_section(
'example_section_img',
array(
'title' => 'Example img',
'description' => 'This is a settings img.',
'priority' => 36,
)
);
$wp_customize->add_setting( 'img-upload' );
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'img-upload',
array(
'label' => 'Image Upload',
'section' => 'example_section_one',
'settings' => 'img-upload'
)
)
);
}
add_action( 'customize_register', 'example_customizer1' );