theme customizer - can a single option pass multiple values?
In my customizer panel I have a radio button for hiding or showing a feature on my WordPress site. However I need to pass multiple values when a single option is selected.
e.g.
the related sections in my functions.php looks like this:
$wp_customize- add_control('blog_setting', array(
'label' = __("Turn on / off the blog link", 'portfolio'),
'section' = 'Layout_options',
'settings' = 'blog_setting',
'type' = 'radio',
'choices' = array(
'block' = 'Blog link visible',
'none' = 'Blog link hidden'
)
) );
and I change the css with this value like this:
function css_customizer(){
?
style type="text/css"
.blog__Link{display: ?php echo get_theme_mod('blog_setting'); ?}
/style
?php
}
add_action('wp_head', 'css_customizer');
However I need to implement something like this (note **)
$wp_customize- add_control('blog_setting', array(
'label' = __("Turn on / off the blog link", 'portfolio'),
'section' = 'Layout_options',
'settings' = 'blog_setting',
'type' = 'radio',
'choices' = array(
'block', '1'** = 'Blog link visible',
'none', '0'** = 'Blog link hidden'
)
) );
and access the second value like this:
function css_customizer(){
?
style type="text/css"
.blog__Link{display: ?php echo get_theme_mod('blog_setting[0]**'); ?}
.second_css_class{opacity: ?php echo get_theme_mod('blog_setting[1]**'); ?}
/style
?php
}
add_action('wp_head', 'css_customizer');
Is this possible? I understand that it is possible to use javascript-theme-customizer, but this seems to be over complicated, I simply need to pass multiple values for each option, and be able to access them. thanks.
Topic theme-customizer radio wp-admin custom-field customization Wordpress
Category Web