This one may have been answered before but I could not find it anywhere.

I have created a custom theme and a plugin for my site. My theme’s functions.php file only contain a wp_nav_menu() function for generating a menu.

Now in my plugin when I try to connect my CSS and JS with

function my_css_js() {
   wp_enqueue_style( 'css_style', theme_URL . 'css/style.css' );
   wp_enqueue_script( 'my-jquery_file', theme_URL . 'js/jquery.uploadfile.min.js', array(), null );
}
add_action('wp_enqueue_scripts', 'my_css_js');

This does not load any CSS or JS in on my site.

As you can see I have used wp_enqueue_style and wp_enqueue_script.

This is not loading the CSS and JS I need.

Is there anything I missed? When I use this same plugin with the same hook in ready made theme this works like charm.

I appreciate any help, thank you

1
1

I have found this small error in my code which stops wp_enqueue_scripts() to work in my theme was I forget to put wp_head in my head section.

For another person who may make same mistake are advised to check that they have include wp_head in head part and wp_foot at end of your theme.

Leave a Reply

Your email address will not be published. Required fields are marked *