[wp-hackers] howto including full path in javascript file.
Chris Scott
cjscott69 at gmail.com
Mon Feb 8 18:40:50 UTC 2010
On Mon, Feb 8, 2010 at 12:45 PM, Bjorn Wijers <burobjorn at gmail.com> wrote:
> Hi,
>
> I was wondering what other people use to include full paths in their
> theme javascript files and keep it dynamic (so no hardcoded paths!). For
> instance I would like to call some images in my javascript file and I
> need to use a full path. What would be the best practice for this?
You can add an action to wp_head to set a js var that is the URL to
your site (e.g. using bloginfo('siteurl')). Make sure this action runs
at a higher priority than your other js if you aren't putting them in
the footer so the var is available to your scripts.
--
Chris Scott
http://iamzed.com/
http://hailtheale.com/
>
> Thanks,
>
> grtz
> BjornW
>
> --
>
> met vriendelijke groet,
> Bjorn Wijers
>
> * b u r o b j o r n .nl *
> digitaal vakmanschap | digital craftsmanship
>
> Concordiastraat 68-126
> 3551 EM Utrecht
> The Netherlands
>
> phone: +31 6 49 74 78 70
> http://www.burobjorn.nl
> _______________________________________________
> 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