Load script only when you need it

Marko Krstić
18 Jan 2020

In code block when you are using script add to PHP tab:

<?php 
	wp_enqueue_script( 'magic-grid', '/wp-content/plugins/_NZP_Devs-Toolbox/node_modules/magic-grid/dist/magic-grid.min.js', '', '1.0.0', true );
?>	

You need to put path from /wp-content/ and not just plugins folder

PHP

JavaScript

Note: Got this trick from a good friend Alexander Buzmakov.
Visit his tutorials oxywp.com.

Was this article helpful?

Tags

Categories

Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy