[wp-hackers] shortcode for images?

Jon Mihkkal Inga lilla.molnet at gmail.com
Fri Jan 30 13:13:47 GMT 2009


Hi there.I agree with Paul in that hardcoding the attachment url in posts is
an obstacle when it comes to portability and customisation.
If you for example want the attachments to be wrapped in a particular way
you are forced to use regex or shortcodes in any case and this is extremely
cumbersome when having to deal with captions that are still shortcodes at
the time of filtering. I'd also like to point out that the inheritance of
attachments is a bit awkward. As I understand it, children are found through
the content of the "post_parent" field. Wouldn't it be cleaner and more
predictable to have a "post_children" field instead?
That would surely speed up the get_children call, as it will not need to
inspect more than one field of post XX to find its children. That would
perhaps ease performance penalties imposed by not inserting attachment urls
in posts.

/j

2009/1/30 scribu <scribu at gmail.com>

> >
> > When you upload an image through the default media upload and you enter a
> > caption for the image then insert into post what is inserted is something
> > like:
> >
> > [caption id="attachment_2817" align="aligncenter" width="212"
> > caption="Corporate America More GLBT-Friendly Than Ever."]<a href="
> > http://www.hrc.org"><img src="
> > http://blogstaging.hrcsupport.org/wp-content/uploads/2009/01/side.jpg"
> > alt="Corporate America More GLBT-Friendly Than Ever." title="side"
> > width="212" height="90" class="size-full wp-image-2817" /></a>[/caption]
> >
> > When you view this in the WYSIWYG you will see the image and the caption
> > text below it. Simple enough.
> >
>
> I think shortcode for captions is justified because there isn't a HTML
> equivalent for them, which is not the case for images.
>
> Adding a performance hit of this magnitude just to make a single
> > event easier to handle is a poor solution. I also think that it's
> > barking up the wrong tree.
> >
>
> I agree. Speaking of migrations, what would happen if you would want to
> switch to something other than WP? You would have to use another script to
> parse the shortcodes, which can lead to other problems.
>
> --
> http://scribu.net
> _______________________________________________
> 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