[wp-testers] Enqueue script if shortcode exist

Alex Hempton-Smith hempsworth at gmail.com
Sun Jun 6 11:47:38 UTC 2010


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 <lox.dev at knc.nc> 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
> lox.dev at knc.nc
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>


More information about the wp-testers mailing list