[wp-hackers] Loading scripts in WordPress
Haluk Karamete
halukkaramete at gmail.com
Tue Dec 10 22:20:10 UTC 2013
>> you can simply call wp_enqueue_script() inside your shortcode
callback, which will ensure that your scripts only get enqueued when the
shortcode is parsed.
That's interesting Chip. I thought that would have been too late.
Isn't it that when the "the_content()" is running, wp_head action hook has
already been executed?
On Tue, Dec 10, 2013 at 12:23 PM, Dave Navarro <dave at topekadesign.com>wrote:
> Thank you for your quick response. I'll take a look at that.
>
>
> On 12/10/2013 2:22 PM, Chip Bennett wrote:
>
>> Shortcodes are parsed at the the_content filter.
>>
>> That said: you can simply call wp_enqueue_script() inside your shortcode
>> callback, which will ensure that your scripts only get enqueued when the
>> shortcode is parsed.
>>
>>
>> On Tue, Dec 10, 2013 at 3:20 PM, Dave Navarro <dave at topekadesign.com>
>> wrote:
>>
>> At what point does WordPress process short codes in content?
>>>
>>> I have a short-code I created for displaying a custom Google map and I
>>> only want to load the necessary javascript files if the short-code is
>>> used
>>> on a page. Are short-codes processed before the headers are sent to the
>>> browser or after?
>>>
>>> Thanks!
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list