[wp-hackers] configure external url in functions?

Lee Rickler info at a5d.org
Sun Apr 8 12:45:03 UTC 2012

Not sure if this is possible, but it seems such a simple thing to implement so I may be missing the point.

In the same way you can use bloginfo() or get_stylesheet_directory_uri() to specify a direct path is there a way to define an external URL so it can be included in the same way?

As a general example, I want to pull an image from a CDN.

To grab the image in the 'normal' theme folder you could simply write:
<img src="<?php get_stylesheet_directory_uri(); ?>/images/image.png">

but using the CDN I will have to use something like:
<img src="https://s3.amazonaws.com/BUCKETNAME/images/image.png">

What would be super extra spiffy is if I could use something like:
<img src="<?php get_cdn_uri(); ?>/images/image.png">

Possible? Newbie question? Completely off my rocker?



More information about the wp-hackers mailing list