here is my functions.php code to enqueue the scripts and styles:
// Add scripts and stylesheets
function first_afro_theme_scripts() {
wp_deregister_script( 'jquery' ); // deregisters the default WordPress jQuery
wp_enqueue_style( 'first-theme-bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', array(), '3.3.5' );
wp_enqueue_style( 'first-theme-blog', get_template_directory_uri() . '/assets/css/first-theme-blog.css', array(), '3.3.6');
wp_enqueue_script( 'first-theme-bootstrap-script', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js', array( 'jquery' ), '3.3.5', true );
}
add_action( 'wp_enqueue_scripts', 'first_afro_theme_scripts' );
In the header.php file i have added,
But but when i go to view page source i dont see any of these styles and scripts. I made sure the path are correct.
in my plugins folder, it is a little different. here is the code to enqueue the function:
// Enqueue the custom JavaScript file
function newsletter_afro_enqueue_scripts() {
// Enqueue jQuery
wp_enqueue_script( 'jquery', plugin_dir_url( __FILE__ ) . 'includes/assets/js/jquery-3.6.0.js', array(), '3.6.0', true );
// Enqueue the custom CSS file
wp_enqueue_style( 'newsletter-style', plugin_dir_url( __FILE__ ) . 'includes/assets/css/style.css', array(), '1.0.0', 'all' );
// Enqueue the custom JavaScript file
wp_enqueue_script( 'newsletter-script', plugin_dir_url( __FILE__ ) . 'includes/assets/js/newsletter-script.js', array( 'jquery' ), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'newsletter_afro_enqueue_scripts' );
on view page source, i see the newsletter-style-css but not the script. the scripts files are not working. what am i doing wrong?
I have checked my code many many times. I have checked the path to the files and confirm it is correct. I have looked up on tutorials to see what i am doing wrong i still can't. I have cleared my cache.