[wp-hackers] Image URL changes

Otto otto at ottodestruct.com
Wed Mar 3 20:29:17 UTC 2010


On Wed, Mar 3, 2010 at 12:58 PM, Matthew Barr <mbarr at interactiveone.com> wrote:
> In implementation, it might be a short code, with the file path -
>
> [wpimg  files/2010/02/image.jpg]
>
> Or anything else that y'all think is a good way to implement it.

I like it, but it's not generic enough for me.

How about if you did something like this in a post?
<img src="[homeurl]/wp-content/uploads/whatever.jpg" />

[homeurl] is simply replaced with the home url. The shortcode handler
for that is like two lines of code:
function homeurl_shortcode() { return get_option('siteurl'); }
add_shortcode('homeurl', 'homeurl_shortcode');

Or, if you want it more specific, have [homeurl], [contenturl],
[adminurl], etc... Whatever makes sense.

-Otto


More information about the wp-hackers mailing list