开发者

Wordpress CSS Changer?

I ha开发者_如何学Cve a light colored wordpress theme. I have made a Dark version of this theme by making a new version of the css.

I want visitors to be able to change from the light to the dark version, essentially just changing which CSS file they are using.

Is this possible to do?


Yes, this is possible.

You have to check what option(light or dark) they selected and include style file accordingly.

if($theme_selected == 'light')
{
  echo '<link rel="stylesheet" type="text/css" 
        href="http://mydomain.com/theme_url/light.css" />';
}
else
{
   echo '<link rel="stylesheet" type="text/css" 
          href="http://mydomain.com/theme_url/dark.css" />';
}


Have a look at the following links to get started with a theme options page in Wordpress. You'll be able to let someone select a "grey" theme, or a "light" theme, or whatever you set. Whatever is set in the admin will then be the loaded stylesheet.

You want to look at the "color scheme" part of this tutorial:

http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wordpress-options-panel/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜