In the previous recipe, we covered the general way in which you provide your theme's users with an options page. In this recipe, you'll implement one of the most straightforward features that many premium themes possess: a theme color scheme chooser.
You need to have created a WordPress theme containing at least a style.css
file and an index.php
file. Inside the template file containing your theme's<head>
tag, you need to call the wp_head
function.
You're going to be controlling the color schemes that users can select, by putting each one in a different CSS file. As such, the first thing that you have to do is to create these files. Open your theme's directory and create a new directory named schemes
. Inside the schemes
directory, create the files blue.css, red.css
, and green.css
. They should contain the following styles:
@charset "utf-8"; /* Blue.CSS Color Schemes Document Chapter 11 Example 2 */ body{ color:...