wp_print_scripts
and wp_print_styles
hooks are fired way before your widget function so that is way it’s not working.
A solution to that would be to include the scripts in the footer using wp_print_footer_scripts
hook, take a look at Jan’s answer to a similar question
Or a much nicer solution take a look at Sorich’s answer to another similar question
Related Posts:
- iris color picker in widget – click event doesn’t fire when initially when widget is first created
- Enqueue script/style if certain widget has certain value
- How can I use the built in WordPress “browse link” functionality?
- How to use wp_dequeue_style() for style enqueued in WP_Widget class
- Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?
- WP_enqueue_script() loads them always in wp_footer()?
- Enqueue script only when side widget is used
- How to check widget-cpt meta and display its custom css in the head?
- Widget Admin page and Javascript enqueuing
- How do I get shortcode, widget and template tag CSS to load in the head only as required? [duplicate]
- How do I Enqueue styles/scripts on Certain /wp-admin Pages?
- changing wp-admin/widgets.php
- How to enqueue script if widget is displayed on page?
- Get list of scripts / styles and show file which enqueued them
- Get Widget Instance inside Widget
- Add the sidebar/widget editor to the post edit screen?
- How to Validate Widget Input
- Get the list of enqueued/registered scripts for a specific post?
- Remove before_widget / after_widget content from Wp_Widget_Text
- Big side banners
- Display specific widgets in different area’s around the page
- Need help adding additional controls to a custom widget Part 2
- How to add the widgets manually to the sidebar?
- How to check if widget has automatic title
- /images/image.jpg not working in sidebar
- Loading scripts & styles from a meta box callback function
- Unable to save widget contents
- Use wp_enqueue_style based on user option in widget
- Creating a admin widget for /wp-admin/post.php?
- dynamic_sidebar() returns false in admin section
- Moving comments section to left of content (Twenty Thirteen)
- Custom Tag Cloud widget missing tags
- Asset loading with gulp.js or Grunt
- How the widget can be run by shortcode
- Optimizing WordPress’s styles and scripts
- How to add new sidebar widget area to child theme?
- Include chat (HTML, js, css) in all pages of WordPress
- Uses Cases for the Calendar Widget
- Problem with widgets
- How to make multi -column, interesting home page in Weaver 2010?
- Multilple single-use widgets with the same output callback
- wp_editor is not rendering shortcode
- Recent Posts – Show all posts
- Widgets missing after update
- Dashboard Widgets – Add Admin Page With Same Functionality
- Debugging / displaying errors in WP_Widget->form()
- Help with custom widget options! (saving checkbox option)
- How to filter products using filter products by attribute widget and OR logic between different product attribute types?
- How to add multiple footer widgets?
- Displaying info in a sidebar
- wp_get_attachment_image() not displaying post images even though wp_get_attachment_url() echo correct urls
- Create a simple widget
- what is the best way to add things to a side bar
- Disable a plugin’s widget
- How to make my shortcode load scripts and styles, from within the plugin?
- Why is WordPress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?
- Trying to filter tag cloud args, but it removes the wrapper
- How to add custom tinymce plugin to new text widget
- What widgets are used on a page? [closed]
- How do I get an array of widgets?
- How not to display an instance of a widget dynamically?
- Twenty Twelve Widget Taking Space
- Conditional widget_form_callback
- How can I re-register my blogs widgets?
- Replace the “widgets” label in the backend
- Any advice on customising this twitter feed?
- activate custom sidebar widgets
- Change number of widget columns in dashboard?
- Inject “fake” category to widget/block
- wp enqueue style on about us page
- How do I dequeue js/css at the last possible moment?
- Sorting Tag Cloud by Popularity
- How to customize WordPress dashboard for different users?
- wp_list_widget_controls() undefined
- Force update widget customizer using js
- Use customizer or sidebar for header settings?
- Script in sidebar blocks other widget’s load
- WordPress version quick check?
- Can I get variable into dynamic sidebar?
- How to show a widget for logged-in users only?
- Can’t output the number 0 in widget
- if is within sidebar [duplicate]
- Diplaying widgets causes responsive slider to not show up
- iframe not being displayed in a widget
- how to call new widgets in sidebar in custom theme?
- wp_enqueue doesn’t load dependencies
- Run an action only when Widget actually instantiated (not just registered)
- My blog has a design issue.
- Call sidebar from a template
- Strange widget behavior
- WordPress Widgets no drop down
- WordPress RSS widget and Yahoo Pipes
- Putting a URL, for a preview, in a side bar
- Full Width Container Colour Problems
- How to make custom dashboard widget to display alert in front-end?
- how to enable full width page template in woo theme memorable?
- Can’t remove a widget from admin
- Add a twitter feed to my WordPress website
- How to create a dashboard to show current user analytics in buddypress
- functions.php doesn’t load all custom theme assets