I can't in any way include css in my theme using functions.php
I tried to include css using the link tag, but it only loads it on the first page, then when I go to open other pages (for example the example page) I don't load any style, how can I do it?
this is the code:
function theme_styles()
{
wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'font', get_template_directory_uri() . '/css/font-awesome.min.css' );
}
add_action('wp_enqueue_scripts', 'theme_styles');
I can't in any way include css in my theme using functions.php
I tried to include css using the link tag, but it only loads it on the first page, then when I go to open other pages (for example the example page) I don't load any style, how can I do it?
this is the code:
function theme_styles()
{
wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'font', get_template_directory_uri() . '/css/font-awesome.min.css' );
}
add_action('wp_enqueue_scripts', 'theme_styles');
Share
Improve this question
edited Jan 9, 2020 at 17:48
Pat J
12.5k2 gold badges28 silver badges36 bronze badges
asked Jan 9, 2020 at 15:31
Andrea SalvatoreAndrea Salvatore
11 bronze badge
3
|
1 Answer
Reset to default 0In your first enqueue type get_stylesheet_directory_uri() instead of get_template_directory_uri For stylesheet its functions.php requires get_stylesheet_directory_uri()
get_stylesheet_directory_uri()
to point to child theme stylesheets.get_template_directory_uri()
pulls from the parent theme. – WebElaine Commented Jan 9, 2020 at 17:55wp_head()
function inside the<head>
tags? – Jacob Peattie Commented Jan 10, 2020 at 0:04