Tag Archives: Style statement

Another Tip! Quickie: Executing CSS in custom_functions.php

Sometimes we need to execute CSS within the PHP of our custom_functions.php file. This article shows you how to use the “style” statement to do so!

Quickie: Executing CSS in custom_functions.php” is a clear and concise article on how to use the same CSS statements as you use in the custom.css file within your custom_functions.php file. It has an example that illustrates the method.

Yet another “Quickie” filed under the “Tips” section in the “Tips” grouping.

Quickie: Executing CSS in custom_functions.php

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; }

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!