I am creating a wordpress theme and my styles queue is not working.
This is the queue in functions.php
function style_script_enqueue(){
wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/main.css' );
wp_enqueue_style('responsive-styles', get_template_directory_uri() .
'/css/responsive.css' );
wp_enqueue_script('custom_script', get_template_directory_uri() . '/js/script.js', array(), '1.0.0', true);
}
add_action('wp_enqueue_scripts', 'style_script_enqueue');
I have also called wp_head(); , wp_footer(); , and checked the directory.
Do you want to enqueue your CSS/JS in a child theme derived from another existing theme? Unless you build your own theme from scratch, child themes are the preferred practice to extend existing themes (update safe).
If you are in a child theme, there are two functions you might want to consider:
get_template_directory()orget_template_directory_uri()to refer to the parent theme pathget_stylesheet_directoryorget_stylesheet_directory_uri()to refer to the child theme pathPS.: You might want to check if there are multiple functions registered for
wp_enqueue_scripts, which try to enqueue CSS/JS with the identical name. If so, try to altermain-styles,responsive-styles,custom_scriptor the optional priority parameter foradd_actionas described in the function documentation.