'core-js wordpress integration

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?



Solution 1:[1]

You are missing the function input.

midpoint(f, xmin, xmax, points)

So you have to give f You have:

midpoint(points, xmin, xmax) 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 3dSpatialUser