Tag Info

New answers tagged

0

The wp action hook fires pretty early, before the $post object is set. I would suggest using the appropriate hook wp_enqueue_scripts instead, and amending your code to: function profolio_localize_script () { if ( is_singular( 'my-gallery' ) ) { $layoutType = get_post_meta( get_queried_object_id(), 'gallery_layout', true ); // Rest of ...


2

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 to pass ...



Top 50 recent answers are included