I've created a child theme under wp-content/themes/my-theme
with 5 files thus far:
|-my-theme
|----assets
|--------css
|------------bootstrap.min.css
|--------js
|------------bootstrap.min.js
|----functions.php
|----index.php
|----style.css
Now the problem is within my functions.php
file, I've tried adding my .css
and .js
file like this:
<?php
# functions.php
/**
* add css | js files to WP
*/
function theme_asset_setup()
{
# styles
wp_enqueue_style('bootstrap', get_template_directory_uri(). '/assets/css/bootstrap.min.css', []);
# scripts
wp_enqueue_script('bootstrap', get_template_directory_uri(). '/assets/js/bootstrap.min.js', []);
}
/** actions **/
add_action('wp_enqueue_scripts', 'theme_asset_setup');
This half does the job. This adds my .js
and .css
file with this path:
http://site.local/wp-content/themes/twentynineteen/assets/css/bootstrap.min.css?ver=5.1
My parent theme is twentynineteen
as specified in my style.css
file:
/*
Theme Name: My Theme
Author: treybake
Description: foobar
Requires at Least: WordPress 4.9.6
Version: 0.1
License: GNU General Public License v2 or later
Text Domain: my-theme
Template: twentynineteen
*/
So I'm guessing this has some sort of factor on why my .css
and .js
- but I'm not sure how to debug further.
Why is my child theme path being ignored for my css/js files?
Thanks