I’m developing a WordPress custom theme using the child-theme of Understrap.
I’m adding my custom jQuery to child-theme > src > js > custom-javascript.js, and the file is already commented with "// Add your custom JS here."
https://github.com/understrap/understrap-child/blob/main/src/js/custom-javascript.js
I did this as instructed from the Understrap Documentation:
"Add your own JS to /src/js/custom-javascript.js to have them bundled into /js/child-theme.js."
https://docs.understrap.com/#/understrap-child/npm
I’ve run the script in the console, and it works as intended, so the error is not with my script.
Yes, I have tried clearing my cache.
I’ve seen a few other questions related to needing to update a gulpfile.js, but no such file is included in my child OR parent theme, I have used the search function, and I also cannot find it on the Understrap GitHub repo.
Is the script not enqueuing properly? Have I missed something?
Thanks in advance.
EDIT: RESOLVED
Was unable to find the source of the error. Ended up doing a fresh install of the Understrap child theme, and migrating my custom files over. This eventually resolved my problem and the JavaScript started working again.
2
Answers
Resolved the issue by doing a fresh install of the Understrap child theme and migrating my already written custom files over.
I added
define( 'SCRIPT_DEBUG', true );
to wp-config so that thetheme.js
file was loaded instead oftheme.min.js
. This then allowed any of my custom javascript to load. However, when minification is on, the .min.js files don’t get recompiled. I am submitting an issue on Understrap github.