How to skin your WordPress theme

Share this on...

I have comments again, YAY ME!
Not that anyone leaves comments… buuut… 🙁

When I upgraded to WordPress2, I had a hard time making a flexible theme, so I ditched that idea and decided to parse the code myself (like I did with the original WordPress). The problem? My individual posts no longer had comments. (UH OH!)

So how do you make a theme that is flexible with your Domesticat-like skinning abilities?

You make a theme inside a theme, of course. 😀

  1. Open your wp-content/themes/[yourtheme]/header.php file
  2. Put in your skinning information in the header like you usually do.
  3. Open your wp-content/themes/[yourtheme]/footer.php file
  4. Hard code the variable information that you need, particularly this part…
$total_skins = 3;
$default_skin = 3;

if (isset($_REQUEST[‘newskin’])) {
if ( ($newskin<1) OR ($newskin>$total_skins) ) $newskin=$default_skin;
} elseif (isset($_COOKIE[‘skin’]))
$newskin = $_COOKIE[‘skin’];
elseif (isset($_REQUEST[‘newskin’])) {
if ( ($newskin<1) OR ($newskin>$total_skins) ) $newskin=$default_skin;
} else $newskin=$default_skin;

That part is the one that tells your theme what skin the reader has selected using. (It’s slightly changed from the Domesticat version as you can’t set cookies in the footer.).

For whatever reason, WordPress kills all your variables right after it does its thing. You need to re-code your variables in the footer as well.

See what I mean? 😀

Share this on...

Published by Eric Brooks

Web & Graphic Designer, Blogger, Musician, Evil Clown. I also code websites and promote people for a living. Still kind of a jerk, though. Approach with food. PS: Don't listen to Snopes. I am REAL NEWS, and I don't let my crush on Tulsi Gabbard interfere with my objective reporting. So NYAH!

2 replies on “How to skin your WordPress theme”

  1. Well you did have a couple of posts where I would have left you a comment, but I couldn’t!

    phhhhhhtttttt !!!! 😀

    Nice job babe!

Comments are closed.

Disclaimer: The views expressed herein are solely those of Eric Brooks. They do not necessarily reflect those of his employers, friends, contacts, family, or even his pets (though my cat, Puddy, seems to agree with me on many key issues.). In accordance to my terms of use, you hereby acknowledge my right to psychoanalyze you, practice accupuncture, and mock you incessantly with every visit. As the user, you also acknowledge that the author has been legally declared a "Problem Adult" by the Commonwealth of Pennsylvania, and is therefore not responsible for any of his actions.