I was used to integrating core-js via html, which does not seem to work in new versions.
In particular I am trying to implement the core library in a wordpress installation, without great results.
This is how I try to integrate core-js in functions.php:
wp_enqueue_script('core-js','https://cdnjs.cloudflare.com/ajax/libs/core-js/3.22.5/minified.js');
wp_enqueue_script('custom-js', get_stylesheet_directory_uri() . '/js/custom.js');
And this is my script:
var CustomizeColors = {
init: function(){
var blocks = document.getElementsByClassName("block-title td-block-title");
for(i=0; i<blocks.length; i++ ){
if(i%2 == 0){
blocks[i].addClass("red");
}
else{
blocks[i].addClass("blue");
}
}
}
}
Core.start(CustomizeColors);
In console i get:
"custom.js?ver=5.9.3:14 Uncaught ReferenceError: Core is not defined"
Can someone help me?