Welcome to Thesis Theme Tools!

We're marking our one year anniversary with a complete redesign!
Come celebrate with us as we look forward to another great year of stimulating and useful articles -- and of course, our new skins!

Quickie: Executing CSS in custom_functions.php

by Mike Nichols

Sometimes we need to execute CSS code within the PHP in our custom_functions.php file. It’s a simple trick! You use the style statement to wrap your CSS in.

Here’s an example for you:

function use_style_statement() {
?>
<style type="text/css">
.custom #some_id { background: #000000; }
.custom .some_class { position: relative; }
</style>
<?php
}

Note these things:

  • You must turn PHP off with the ?> statement before using the style statement and back on with <?php when you are finished.
  • The CSS statements within the style statement are the same as you would use in the custom.css file

Now, isn’t that easy?

I hope you are able to use this quickie in your code! As always, feel free to leave a comment below. If you want to contact me directly by email, just click the “Contact” tab in the menu.

©2009 Michael L Nichols. All rights reserved.

What next?

Your comments are always welcome, and are important to this blog’s community! Leave a comment now, or read the comments.

You can find several related articles in the “Related Articles” list below. In the footer you will find a lists of Popular Posts, Recent Posts, and you may browse by Categories, or tags. There’s also a Google Custom Search box to help you find just what you want.

Get free updates by RSS or email!

If you have enjoyed this article, please consider subscribing to article updates, using an RSS reader, or by email. It’s free and is a great way to make sure you don’t miss a single article! I also invite you to follow me on Twitter!

Why not share this article with others!

Share this article with your friends using your favorite social media service, such as StumbleUpon, or Digg. Check out the icons below under “Share This Article With Others” for other social media, including del.icio.us, Technorati, Sphinn, Friendfeed, FaceBook, MySpace andLinkedIn! You can also email or print the article, and even tweet it using Twitter!

Share and Enjoy:
  • StumbleUpon
  • Digg
  • del.icio.us
  • Technorati
  • Facebook
  • MySpace
  • FriendFeed
  • Sphinn
  • LinkedIn
  • Twitter
  • email
  • Print
  • PDF
Related Articles category Tags: , , , ,
Related Articles
  • Visit My Other Site!