Custom Customizer Options

This article was last updated on the December 21, 2016.

Not only is the WordPress customizer, great for editing/changing various parts of your website, but it can also be used to add custom code, both CSS and jQuery/Javascript.

Note: You should never enter custom PHP in the CSS or Javascript section of the customizer, doing so could break your site and make it inaccessible.

In this article, we’ll cover adding custom CSS and custom Javascript, we won’t go too in depth on specifics, as there isn’t a need, but follow along with the article and everything should make sense, of course if you have any problems or have a question, our awesome support is just a click away here.

Adding Custom CSS

We’re going to be changing the color of our prompt box title for this tutorial.

Prompt box

First of course, we’ll need to know what the CSS class or div ID is for the specific part we want to change, there’s a few ways you can do this, we won’t be going in depth into that within this article, but you can use Firebug which is for Firefox, you can find that add-on here. Alternatively you can use Chrome developer tools, which there’s a great guide to here.

If you’ve chosen to go with Firebug, there’s a great tutorial on that here.

In our case, the code we need to use is:

	
h2.h-prompt {
	color: #ff0000;
}

Now we have the code we need, let’s head to the Customizer, once you’ve opened up the Customizer, click on Custom

Custom

Once you’ve opened up the custom area, you’ll see two text areas, these are CSS and Javascript.

It’s very important, that you don’t put custom CSS in the Javascript box and that you don’t put custom Javascript in the CSS box, doing so, could break your site.

Custom CSS, Custom JS

Enter your CSS in your Custom CSS area, like this:

Custom CSS entered

As soon as you enter the CSS code, you’ll see the changes reflected in the preview area of the Customizer like this:

Color changed!

If you’re happy with the changes go ahead and click on Save & Publish at the top of the Customizer.

Congrats! You’ve now successfully added custom css, through the WordPress Customizer and have a better understanding of how to add custom CSS. Next up let’s try adding some custom Javascript.

.

Adding Custom Javascript

Under the Custom CSS box, you’ll see the Custom Javascript box, here you can enter Javascript or jQuery, you don’t need to add any script tags here. Just enter your code as needed. So if we wanted we could add a alert by entering the following:

	
alert("Hey!");
	

Then we can see that shows a browser message when we enter it like this:

Browser Message

Enter the code you want and then click on Save & Publish.

Formatting in the customizer

When possible in the customizer, always try to format your code, it’s make it much easier to read and understand, rather than a jumbled up mess. Ideally you should write the code first using a text editor, such as Notepadd++ (Windows) or Coda (Mac)

This ensures, if for some reason you need a developer to debug your site, or anything else, that the code is easy to read and understand.

Congrats! Through this article, you’ve learnt more about the WordPress customizer and how to use the different aspects of the custom code section to further enhance your site and make edits.