[wp-hackers] Image URL changes

Otto otto at ottodestruct.com
Wed Mar 3 22:22:32 UTC 2010


Core needs to be changed to have that everywhere then. I was looking
there to find the right way, found that method.

-Otto



On Wed, Mar 3, 2010 at 2:43 PM, Andrew Nacin <wp at andrewnacin.com> wrote:
> One thing I would recommend is to no longer use
> get_option('siteurl') or get_option('home'). For siteurl, use site_url(),
> and for home, use home_url(). These functions handle SSL, as does
> admin_url().
>
> They're also cleaner to write, and they accept a parameter which then
> appends a path for you.
>
> get_bloginfo('url') and get_bloginfo('wpurl') are now aliases for home_url()
> and site_url(), perspectively.
>
> Adding to this, there has been some talk of an image shortcode. It
> originated as a possible solution to implementing trash for media, but it
> hasn't gained much traction yet.
>
> On Wed, Mar 3, 2010 at 3:29 PM, Otto <otto at ottodestruct.com> wrote:
>
>> 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
> _______________________________________________
> 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