Correctly enqueue scripts of type=text/paperscript (PaperJs Library)

I’m not sure if this will solve your problem, but you can use the script_loader_tag filter to change the type text/javascript to text/paperscript add_filter( ‘script_loader_tag’, function( $tag, $handle, $src ) { if( ‘your-script-handle’ === $handle ) { $tag = str_replace( ‘text/javascript’, ‘text/paperscript ‘, $tag ); } return $tag; }, 10, 3 );

Add custom classes for blocks in editor based on custom attributes

You can do this with the editor.BlockListBlock filter. More info here. This allows you to do something like the following: const withCustomAttributeClass = createHigherOrderComponent( ( BlockListBlock ) => { return ( props ) => { const { attributes } = props; const { yourCustomAttribute } = attributes; const class = yourCustomAttribute ? ‘my_custom_class’ : ”; … Read more

wp_enqueue_script not loading my custom js file

You need to reference your WordPress template directory when you register the script. Change this: wp_enqueue_script(‘my_javascript_file’, ‘/javascripts/app.js’, array(‘jquery’)); …to this: wp_enqueue_script(‘my_javascript_file’, get_template_directory_uri() . ‘/javascripts/app.js’, array(‘jquery’)); Codex reference: get_template_directory_uri()

Adjusting jquery for WordPress

By default, jQuery runs in no conflict mode in WordPress. You have an anonymous function that passes the jQuery object so you can use it. Your code will error on line two because it doesn’t know what $ is. Move the first three lines into the anonymous function to resolve this. (function($){ var array = … Read more

Performance vs plugin genrated javascript

When enqueuing a custom script, you can write them to load in the footer – prior to the </body> tag – making them non-render blocking for most purposes, but they may still come up as render-blocking on testing tools, since they literally must be executed before the page HTML can be considered fully loaded. Instead, … Read more