How to pass data to javascript in custom widget class
This is a timing issue, as you can see from the hook order. By the time you get to the dynamic_sidebar function that executes your widget code on the front end, you are already past the widgets_init and wp_enqueue_scripts hooks (the dynamic_sidebar hook is inside the function with that same name). You cannot enqueue scripts … Read more