[wp-hackers] configure external url in functions?

fris fris at fris.net
Sun Apr 8 13:27:42 UTC 2012

Frank posted something like this a couple days ago to swap out regular image
urls for CDN.


-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Lee Rickler
Sent: Sunday, April 08, 2012 8:45 AM
To: wp-hackers at lists.automattic.com
Subject: [wp-hackers] configure external url in functions?

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?


wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list