1

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 ) );

}
  • I think the only way is to override the content_template method. I'm sorry but I have no more time today test how to do it. – cybmeta Dec 26 '14 at 17:30
0

As I can see they comepletly changed background image ( or image ) select in customizer.

There's no more tabs for images at all.

But what can you do is create new class wich will extend WP_Customize_Image_Control ( or WP_Customize_Upload_Control ) and add there a choise ( select or radio ) to show upload or sellect pattern.

May be it can be compleated without new class, simply add_control function to add fields and litle js to show hide upload and select pattern box.

Personaly i don't like customizer, so i don't know about it much, but i'v looked to code and add_tab is gone for shore (

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.