131 reputation
14
bio website
location
age
visits member for 2 years, 8 months
seen 21 hours ago

Feb
22
awarded  Necromancer
Jan
15
awarded  Nice Question
Oct
8
awarded  Supporter
Jul
23
awarded  Teacher
Apr
4
comment Conditionally enqueue a widget's script/stylesheet in HEAD (only when present on page!)
Thanks Syslogic! I did give Widget Logic a try too, thinking I could hook into its widget_content filter. No luck unfortunately. It uses ob_start to buffer widget output so you can manipulate it before it's printed to the screen, but this is still happening too late to fire off anything in the head. Unless maybe you know of a workaround?
Apr
2
comment Conditionally enqueue a widget's script/stylesheet in HEAD (only when present on page!)
Thanks, Nick! I did try wp_enqueue_scripts, and while it does load the javascript in the head, it won't load conditionally.
Apr
2
comment Conditionally enqueue a widget's script/stylesheet in HEAD (only when present on page!)
Thanks for your answer, Bainternet! I've just been testing your code and unfortunately, while the javascript does indeed load conditionally, it still loads in the footer...even though it's being called in wp_head. Very strange! (btw, it still does this without the "true" footer instruction). Also, echoing the stylesheet makes it load regardless of whether the widget is on the page. Any ideas?
Apr
1
awarded  Student
Apr
1
asked Conditionally enqueue a widget's script/stylesheet in HEAD (only when present on page!)
Mar
20
answered Disable plugin / plugin action via theme