[wp-hackers] Newbie Q - accessing different image sizes
scribu
scribu at gmail.com
Sat Apr 11 11:16:43 GMT 2009
On Sat, Apr 11, 2009 at 1:01 PM, Jan Erik Moströ <lists at mostrom.pp.se>
wrote:
> On 09-04-11 at 10.43, scribu <scribu at gmail.com> wrote:
>
>> Jan, maybe you should describe what you're trying to do, so that we
>> have a broader picture.
>
> OK, I might go about this in completely the wrong way so I better describe
> it.
>
> I want to show pictures in my posts and I've got two requirements:
>
> + I want to be able to move site to another domain if I have to,
> so I want all urls to be relative in my posts
>
> + I want to use a lightbox effect but I want to use my own markup
> so it's presented the way I want - to do the lightbox effect I
> need to access two different sizes of the photo.
>
> + I don't want to "hardcode" the presentation in the entries since
> I might change my mind on how it should work later, by using a
> custom markup it becomes pretty easy to make such a change.
>
> I add new posts and images using the XML-RPC interface (I never write
> anything from within WP). A post would typically look something like this
>
> bla bla bla bla bla bla bla bla bla bla
> bla bla bla bla bla bla bla bla bla bla
> bla bla bla bla bla bla bla bla bla bla
>
> (:photo src='rel/path/to/photo' capt='bla bla bla':)
>
> bla bla bla bla bla bla bla bla bla bla
> bla bla bla bla bla bla bla bla bla bla
> bla bla bla bla bla bla bla bla bla bla
You should try using shortcodes
<http://codex.wordpress.org/Shortcode_API>which are already built into
WP and are quite easy to create. Instead of
supplying the src, why not do something like this:
[photo id='123' capt='bla bla']
where the id is the attachment id. If you have the id, then you can use all
the functions mentioned above.
--
http://scribu.net
More information about the wp-hackers
mailing list