How to pass a variable for key/value pairs in an argument?
For example, this works:
'default' = '#ffffff'
But this does not:
$white = '#ffffff';
'default' = $white
How can I pass variables to key/value pairs?
Here is a more complete example for some context:
$white = '#ffffff';
$transport = 'refresh';
$wp_customize-add_setting('mytheme_text_color', array(
'default' = $white,
'transport' = $transport
));
In reply to jgraup:
This code works:
$wp_customize-add_setting('themeone_primary_nav_background_color', array(
'default' = '#181818',
'transport' = 'refresh'
));
This code doesn't:
$args = array('default' = '#181818', 'transport' = 'refresh');
$wp_customize-add_setting('themeone_primary_nav_background_color', $args);
When I customize my page colors in the admin section, I should see a "default" color button. In the former code, I see this button. In the latter code, I do not.
I have uploaded the file to my google drive if anyone wants to take a look: https://drive.google.com/open?id=0B01XHUEqiziEcW14WE5NN0VYYlE
And here is a picture of the problem with example output: https://drive.google.com/file/d/0B01XHUEqiziEUDVyZWFRWGZ0SkE/view?usp=sharing
Topic wp-parse-args variables Wordpress
Category Web