0

I'm trying to load style.css but rest.css should be included first. I don't understand why reset.css is not included

function addMyScript() {
    wp_register_style('style', get_template_directory_uri().'/style.css');
    wp_register_style('reset', get_template_directory_uri().'/reset.css');
    wp_enqueue_style('style', get_template_directory_uri().'/style.css', array( 'reset' ),  );
}
add_action('wp_head', 'addMyScript');

Also I've seen on some blogs that people often don't register the stylesheet or javascript before to enqueue... is that ok?

0

You have to define the dependencies for either styles or scripts when you register them. Or, if you're avoiding the registration completely, then it's ok to stuff them into the queueing process. See more on the Codex page.

wp_register_style( 'reset', get_template_directory_uri().'/reset.css' );
wp_register_style( 'style', get_template_directory_uri().'/style.css', array( 'reset' ) );

wp_enqueue_style( 'style' );

Also avoid single , inside a function argument definition. This will not work. Better turn on Debugging stuff in your wp-config.php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.