Color Picker Wordpress Control with a Dynamically Added CSS Class

Image for post
Image for post
<my-element style=”background-color: <?php echo get_theme_mod(‘setting_element_color’); ?>”></my-element>
<my-element style=”--bg-color: <?php echo get_theme_mod(‘setting_element_color’); ?>”></my-element>
dynamic_class {
background-color: var(--bg-color);
}

Written by

Front-end Web Developer. Language lover. Traveler. Dude.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store