Kshitiz Dhungel
Kshitiz Dhungel

Reputation: 37

How do i solve css problem while developing theme on wordpress?

I am developing my theme using undersocres.me for wordpress. When i started to develop and used

  wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css'); 

it showed error .

wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css');

bootstrap.css:8 Uncaught SyntaxError: Unexpected token :

Upvotes: 0

Views: 44

Answers (2)

Luís P. A.
Luís P. A.

Reputation: 9739

Just change get template directory to get_stylesheet_directory_uri() and the enqueue to wp_enqueue_style

Example:

wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri() . '/css/bootstrap.css');

https://developer.wordpress.org/reference/functions/wp_enqueue_style/

Upvotes: 0

Vel
Vel

Reputation: 9341

you need to use wp_enqueue_style instead of wp_enqueue_script

wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri() . '/css/bootstrap.css');

Upvotes: 1

Related Questions