I have been using add_tab to add a tab in Customizer with default images. It is deprecated and no longer works in WordPress 4.1. How can I create/find an alternative?
add_action( 'customize_register','add_pattern_images', 12, 1 );
function add_pattern_images( $wp_customize ) {
$control = $wp_customize->get_control( 'aaa[backgroundpattern]' );
$control->add_tab( 'theme_patterns', 'Theme Patterns', 'pattern_images' );
}
function pattern_images() {
$backgrounds = array(
'/library/images/background_pattern/background_pattern_01.png',
'/library/images/background_pattern/background_pattern_02.png',
'/library/images/background_pattern/background_pattern_03.png',
'/library/images/background_pattern/background_pattern_04.png',
'/library/images/background_pattern/background_pattern_05.png',
'/library/images/background_pattern/background_pattern_06.png',
'/library/images/background_pattern/background_pattern_07.png',
'/library/images/background_pattern/background_pattern_08.png',
'/library/images/background_pattern/background_pattern_09.png',
'/library/images/background_pattern/background_pattern_10.png',
);
global $wp_customize;
$control = $wp_customize->get_control( 'aaa[backgroundpattern]' );
foreach ( (array) $backgrounds as $background )
$control->print_tab_image( esc_url_raw( get_template_directory_uri() . $background ) );
}
Aucun commentaire:
Enregistrer un commentaire