user1406440
user1406440

Reputation: 1645

Wordpress custom CSS path

I'm not sure if this is a wider issue with Wordpress or just with the HTML5 Blank theme I'm using but basically the functions.php is looking for /style.css. As I keep my CSS files in a folder I'd like the theme to mirror my static HTML templates if possible. I tried amending the line to the following:

function html5blank_styles()
{
    //wp_register_style('normalize', get_template_directory_uri() . '/normalize.css', array(), '1.0', 'all');
    //wp_enqueue_style('normalize'); // Enqueue it!

    wp_register_style('html5blank', get_template_directory_uri() . '/css/main.css', array(), '1.0', 'all');
    wp_enqueue_style('html5blank'); // Enqueue it!
}

That was the only reference to the stylesheet(s) so I thought simply changing the name/path to what I have would work but it causes the theme not to load.

Any ideas? Or am I going about this totally the wrong way?

Upvotes: 0

Views: 2040

Answers (1)

Alex
Alex

Reputation: 2775

You are free to connect additional CSS files via wp_register_style, but you can't delete style.css, because this file is necessary for the WordPress theme functionality. But if you don't need styles from this file, then you can remove all CSS code from style.css, but keep the data required for WordPress Theme. So your style.css can look like this:

/*
Theme Name: WP Theme name
Theme URI: https://wordpress.org/
Author: Author
Author URI: https://wordpress.org/
Description: WP Theme.
Version: 0.1
*/

Upvotes: 1

Related Questions