Answer the question
In order to leave comments, you need to log in
Why doesn't the local server see the included styles and scripts?
Good afternoon. I myself work very little with VP, but it is the local server that delivers the main difficulty. Often, when opening a site, I am redirected to wordpress.org, but this is half the trouble - the VP refuses to see the included style files and scripts every other time. I connect like this:
add_action('wp_enqueue_scripts', 'style_theme');
add_action('wp_footer', 'scripts_theme');
function style_theme()
{
wp_enqueue_style('style', get_stylesheet_uri());
wp_enqueue_style('album', get_template_directory_uri() . '/assets/css/album.css');
wp_enqueue_style('docs', get_template_directory_uri() . '/assets/css/docs.min.css');
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css');
}
function scripts_theme()
{
wp_enqueue_script('jquery', get_template_directory_uri() . '/assets/js/jquery-slim.min.js');
wp_enqueue_script('bundle', get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js');
wp_enqueue_script('jquery', get_template_directory_uri() . '/assets/js/jquery-slim.min.js');
wp_enqueue_script('docs', get_template_directory_uri() . '/assets/js/docs.min.js');
}
Answer the question
In order to leave comments, you need to log in
I think there is some subtlety of working with VP. Tell me who knows.
Check the paths and file names again, try using it via https://wp-kama.ru/function/get_template_directory
And discard what errors it shows in the console and + your path to the files
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question