Use WordPress functions to include your CSS

When I’m not developing for WordPress, I try to use a specific folder structure for my project. I have all my .css-files in the /css/-folder, all JavaScript in /js/-folder and so forth.

I tried to keep this up for WordPress, and placing my CSS in the root instead of the theme folder, but this quickly changed. Mainly because it’s easier to manage when you have all your files in one folder (your theme folder). And also because it’s not the way it’s meant to be done.

You can use functions as bloginfo(“stylesheet_url”) to include style.css. The function generates a complete URL, which is great since you should always have a complete URL due to performance issues.

Advertisements
About

Web Developer @ Oakwood Creative - www.oakwood.se

Tagged with: ,
Posted in Beginner, Best Practices

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

About

WordPress Quick Tips is a blog supplying great tips about WordPress.

We hope to create a great knowledge resource for WordPress developers as well as serving a reminder for all the forgetful ones.

The blog is created and run by Vincent of Oakwood Creative

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 120 other followers

%d bloggers like this: