Quantcast
Channel: WordpressErrors
Viewing all articles
Browse latest Browse all 147

Adding the CSS for a Color Scheme in the Theme Customizer

$
0
0

In the first part of this two part series, I showed you how to create the settings and controls for a color scheme in the WordPress theme customizer. In this part, you’ll use these to define CSS in the theme based on what users select using the customizer.This consists of four steps:Defining a variable based on each of the options your users select in the customizerUsing the value of these variables to define CSSAdding classes to the body element based on the radio box selections in your ‘Solid Backgrounds’ sectionUsing these classes to define the CSS for the header and footer.We’ll start by defining variables for the colors.Defining Variables for the Colors in Your Color SchemeIn your customizer.php file that you created in the previous part of this tutorial, add a new function:function wptutsplus_customize_colors() add_action( ‘wp_head’, ‘wptutsplus_customize_colors’ );This function will contain everything you need to generate CSS based on selections made in the theme customizer, and is hooked to the wp_head action hook so that any styles are added to the <head> section of the page being displayed

View article:
Adding the CSS for a Color Scheme in the Theme Customizer


Viewing all articles
Browse latest Browse all 147

Trending Articles