That will not work.
Shortcodes are parsed too late, as in, They're passed when the content is
being displayed, which is after the headers have been sent.
The only available method right now, is in wp_head hook, scan
$posts[1....$count]->post_content for your shortcode and
wp_enqueue_script() your script then AFAIK
On Sun, 06 Jun 2010 21:47:38 +1000, Alex Hempton-Smith
<[email protected]> wrote:
Bear in mind wp-hackers is probably a better list for this question.
If you want jquery to be enqueued when a specific shortcode is included,
just have it within the shortcode function:
function myshortcode_func(){
wp_enqueue_script('jquery');
echo 'jQuery has been enqueued!';
}
add_shortcode('myshortcode', 'myshortcode_func');
-- Alex (Hempsworth)
On Sun, Jun 6, 2010 at 7:36 AM, Lox <[email protected]> wrote:
Hello,
I need to enqueue jquery when a specific shortcode is found in a page.
Has such a feature been implemented in 3.0 ?
--
Lox
[email protected]
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers
--
Dion Hulse / dd32
Contact:
e: [email protected]
Web: http://dd32.id.au/
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers