I am using wordpress theme customizer to change color scheme of my theme but was wondering if there is any shorter way to achieve this from what i have below. Thank you.
wp.customize('orn_color_scheme',function( value ) {
value.bind(function(to) {
var $color;
if($('body').hasClass('default')) { $color = 'default' }
if($('body').hasClass('beige')) { $color = 'beige' }
if($('body').hasClass('blue')) { $color = 'blue' }
if($('body').hasClass('celadon')) { $color = 'celadon' }
if($('body').hasClass('cherry')) { $color = 'cherry' }
if($('body').hasClass('cyan')) { $color = 'cyan' }
if($('body').hasClass('dark')) { $color = 'dark' }
if($('body').hasClass('dirty-green')) { $color = 'green' }
if($('body').hasClass('orchid')) { $color = 'orchid' }
if($('body').hasClass('red')) { $color = 'red' }
$('#orbitnews-color-scheme-css').attr('href', '<?php echo get_template_directory_uri(); ?>/layouts/colors/' + to + '.css');
$('body').removeClass($color).addClass(to);
});
});
$is often placed at the beginning of variables to signify the variable contains a jQuery collection