ivvi
ivvi

Reputation: 5310

style.css in css directory (i.e. not in theme root)

I'm new to WordPress and this is my first attempt to migrate a static website to WordPress. The websites layout must remain unchanged so I intend to develop a theme for it.

I'm used to having css files in the css directory, but the WordPress Theme Development page states that there has to be a style.css in the theme root.

Can I setup WP to get css/style.css instead? What is the recommended way to organise css files in WP?

Upvotes: 1

Views: 1326

Answers (1)

Beto Frega
Beto Frega

Reputation: 976

You can use Wordpress' wp_enqueue_style.

function addMyScript() {
wp_enqueue_style( 'my-style', get_template_directory_uri() . '/css/my-style.css', false, '1.0', 'all' );
}
add_action('wp_head', 'addMyScript');

Just remember that you still need to have a style.css inside your theme root, even if it only has the details about the Theme in the form of comments.

Please refer to: http://codex.wordpress.org/Function_Reference/wp_enqueue_style

Upvotes: 1

Related Questions