3

I am a little bit of a newbie at Wordpress theme development, and I can't find the answer here or through much Google foo, so I wanted to find out if this scenario is possible.

I'm writing a child theme for Themetatic and I wanted to provide end users with the ability to change CSS color values and font family from a dialoge box in the theme controls. Does this require storing their entries in the database or can I just store these directly in the CSS file?

1
  • I think that CSS will be better option. Commented Nov 23, 2011 at 16:31

3 Answers 3

1

No, you will need to create a theme_option that WP will store in the database and an interface for the user to edit these options.

There is a great tutorial on how to do all of this here.

Sign up to request clarification or add additional context in comments.

Comments

0

No you don't need to store them in the database. you can do something like this:

html:

<a id="style1" href="?view=black"></a>
<a id="style2" class="current" href="yourwebsite.com"></a>

and put the following in the header.php

if(isset($_GET['view'])) {

 <link href="style1.css" rel="stylesheet" media="screen">

} else {

<link href="style2.css" rel="stylesheet" media="screen">

}

1 Comment

In this case the user has to create a CSS file, they may as well just edit the current one and not bother with this conditional.
0

The way I would go about doing this would be by creating a Dynamic CSS file after the color/font values have been changed. Your CSS file would then be re-created to include these changed values.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.