0

I've been trying with no success to add a new stylesheet to my template. It's my first time creating a wordpress template. I'm using underscore and this is what I have in functions.php:

style.css is the stylesheet shipped with the template starter.

wp_enqueue_style( 'name-style', get_stylesheet_uri() ); 

I just want to add foundation-icons.css, foundation.min.css and custom.css. Any help? Thanks.

2 Answers 2

1

This is how I do it in all of my templates

/* Enqueue Scripts -----------------------------------------------------------------*/ add_action( 'wp_enqueue_scripts', 'template_enqueue_scripts' ); function template_enqueue_scripts() { wp_register_style('Sub-CSS', get_template_directory_uri() .'sub-style.css'); wp_enqueue_style( 'Sub-CSS'); } 

This is the best way to my knowledge, like I said, I always do it this way. It works flawlessly, and I have never had a problem doing it this way.

Edit

You will notice that no one else uses wp_register_style, and the wp_register_style is the safest way to setup your style for actual enqueue.

Make sure that you wrap the wp_register_style & wp_enqueue_style in a function.

Sign up to request clarification or add additional context in comments.

Comments

1

Try this code :

<?php add_action( 'wp_enqueue_scripts', 'safely_add_stylesheet' ); /** * Add stylesheet to the page */ function safely_add_stylesheet() { wp_enqueue_style( 'prefix-style', plugins_url('style.css', __FILE__) ); } ?> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.