theme customizer – can a single option pass multiple values?

I understand what you are trying to do, but you are going in the wrong direction here, you can just check if one was selected in your logic and assign the value there like this: function css_customizer(){ $blog_setting_val = get_theme_mod(‘blog_setting’); $opacity_val = ($blog_setting_val == ‘block’) ? ‘1’ : ‘0’; ?> <style type=”text/css”> .blog__Link{display: <?php echo … Read more

Allow multiple settings to be stored in a single option in Theme customizer

In your example here, the option stored would be named options and it would contain two array keys, toggle_header and background. To obtain the values, then, you would do: $options = get_option( ‘options’, array() ); $options = array_merge( array( ‘toggle_hedaer’ => true, ‘background’ => ‘normal’ ), $options ); // Accessing stored values here: $toggle_header = … Read more

Theme logo metadata into template file

Ends up that “alt” is not stored in wp_get_attachment_metadata so I pulled it from the post meta: $custom_logo_id = get_theme_mod(‘custom_logo’); if ($custom_logo_id) { $image = wp_get_attachment_image_src($custom_logo_id, ‘full’); $meta = wp_get_attachment_metadata($custom_logo_id); **$alt_text = get_post_meta($custom_logo_id, ‘_wp_attachment_image_alt’, true);** echo ‘<img src=”‘ . $image[0] . ‘” alt=”‘ . $alt_text . ‘” width=”‘ . $meta[‘width’] . ‘” height=”‘ . $meta[‘height’] … Read more

Hide Customizer’s Widget Choices From The List

The only way to disable a Widget from appearing in this list is to unregister it. You can do that just in the customizer: function unregister_customizer_widgets() { if ( is_customize_preview() ){ unregister_widget(‘WP_Widget_Recent_Posts’); } } add_action( ‘widgets_init’, ‘unregister_customizer_widgets’ ); But that will remove it from the page preview and the sidebars. Even if it is used … Read more

Combine two active_callbacks into one on theme customizer

Maybe I’m misreading your question, but combining these two conditions in one anonymous function doesn’t look that difficult: ‘active_callback’ => function() use ( $wp_customize ) { $condition1 == $wp_customize->get_setting( ‘twsa_show_schedule’ )->value(); $condition2 == $wp_customize->get_setting( ‘twsa_show_active’ )->value(); return ($condition1 && $condition2); } For really smart thinking on active callbacks, read Otto’s take on them.

Theme customizer – can’t add section/settings

Your use of add_control is incorrect. More specifically, you are not telling what type of control you want to add. Refer to the codex link to see which types can be generated automatically. I’ve given an example with a text field below. $wp_customize->add_control(‘cta_heading’, array( ‘label’ => __(‘CTA Heading’,’starter’), ‘section’ => ‘home_call_to_action_section’, ‘setting’=>’home_call_to_action_setting_section’, ‘type’=>’text’, )); Beware … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)