I am trying to have use wp_locatize_script for the elementor widget. I am confused with the method to use. I want to pass a php variable to javascript. If i am using a script file the method has to wp_locatize_script. What is the method that is used to put the javascript code to the widget( each instance of a widget may have different variable).

as per this: https://developers.elementor.com/render-widget-template/

i see that javascript is used in _content_template. But most of the time my widget works without it and i don't know why that is used? I see that the javascript is being added in that but when i tried adding a simple alert there it does not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.