Customizer not saving image settings

The problem is in the sanitize_callback = ‘absint’. WP_Customize_Image_Control doesn’t save attachment id so you can’t use absint, If you want to store the ID of the image’s attachment then use WP_Customize_Media_Control, there is also a referance about this here

How do I add customize_register action AFTER adding a custom taxonomy

AFAIK it shouldn’t be a problem to get taxonomy data at the customizer_register hook state. So that problem might have different reasons, but they aren’t apparent from your question. Besides I’m not sure what you are trying to achieve, so you might want to fill the information gaps according to @Rarst’s questions. Aside from that … Read more

Passing array in add_option()

I think that you have added bguru_options option before. If bguru_options already exists, add_option() does nothing. To modify the value of existing options you should use update_option() instead. EDIT I confirm what I thought. You are running add_option(‘bguru_options’, $default_options); in every admin_init. bguru_options option was added to database in the first run and subsequent calls … Read more

How to get custom image size for image uploaded in Customizer

Apparently, your mod is storing the complete path to the image as a string. That leaves you little alternative but to do a search and replace on the string: $img = get_theme_mod(‘image-1’); if (!empty ($img)) { $img = preg_replace (‘.(jpg|jpeg|png|gif)$’,’-525×350$0′); if (!file_exists($img)) $img = get_template_directory_uri().’/images/default.jpg’; } else if (!file_exists($img)) $img = get_template_directory_uri().’/images/default.jpg’; In words. Get … Read more

Show different Customizer Settings on Page-Tamplates

The customizer API offers active_callback methods on both the control andd section classes. Basically you use either an conditional or a custom function to determine if a control or section is shown to the user. If you want a section to appear only for pages, you would do somthing like this: $wp_customize->add_section( ‘wpse_283821_acme_pages’, array( ‘title’ … Read more

Hide/show customizer controls based on other settings in Customizer

you can define the conditional display on definition in PHP with somethign like that : $wp_customize->add_control(“course_instructor_layout”, [ // … other arguments “settings” => “course_instructor_layout”, “active_callback” => function ($control) { return !$control->manager->get_setting(“lmscore_improved_summary”)->value(); }, ]); if that doesn’t work in your case, edit your question to add the complete definition of lmscore_improved_summary and course_instructor_layout.

Theme Customizer Custom Background / Header Image

Here’s some code I use which places a control in the Title’s and Taglines section to add a logo image.. $wp_customize->add_setting( ‘theme_logo’ ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize,’theme_logo’,array( ‘label’ => ‘Logo’, ‘section’ => ‘title_tagline’, ‘settings’ => ‘theme_logo’, ‘priority’ => 1 ) ) ); I then call it in header.php with this bit.. <?php if( get_theme_mod( ‘theme_logo’ … Read more

Make Customizer Load Specific Page

Yes, you can definitely make the customizer load a specific page. You can also set a return page. You can do this with the query strings url & return. You need to pass encoded urls for these to work. So instead of loading http://yoursite.com/wp-admin/customize.php you will want to load http://yoursite.com/wp-admin/customize.php?url=http%3A%2F%2Flocalhost%3A8888%2F%3Fpage_id%3D2 In my example the customizer … Read more