Using wp_localize_script to store the template url into a variable to use in JS
You are not enqueueing your custom JavaScript file. And calling the var (templateUrl) in JS file without the handle. Follow the following: I’m enqueueing my custom JavaScripts file (script.js) under the dependency of jQuery, so it will enqueue jQuery library from core. And I’m using the same handle my-custom-js for both my script and localize_script … Read more