[wp-hackers] wp thumbnails

Dion Hulse (dd32) wordpress at dd32.id.au
Tue May 25 11:26:15 UTC 2010


On Tue, 25 May 2010 21:19:36 +1000, Ana Aires <ana.aires at gmail.com> wrote:

> Hi guys!!
>
> I am struggling with wp thumbnails new feature. Basically I have an
> alternative form to the "Add new post" for adding a new post with a set  
> of
> custom fields. I also would like to add on the new form the possibility  
> to
> set thumbnails. But it seams that the metabox has a lot of dependencies
> spread all over the code. So I would like to know any hints on how this
> actually works. So far I manage to set the thumbnail associated with the
> temporary post, but when I submit something is missing and the thumbnail
> does not associate with the post. I suppose that I need to add something  
> to
> the wp_x_postmeta table but I honestly don´t get where does the  
> meta_value
> for the _thumbnail_id come from...
> Did anyone played with this already?
>
> If I was not clear but you know how the thumbnails work internally please
> let me know and I try to explain better.
>
> Thanks in advance,

The Post thumbnails in core are set within the media manager, when you  
click the link to add the thumbnail, that request goes to the server, sets  
the thumbnail ID, and returns some JS to update teh main page.
The Thumbnail ID is the attachment ID from the posts table.

Another thing of note to you, Is that WordPress no longer interally uses  
the "-<time>" post id's, When you enter the edit.php page, a auto-draft is  
created, which is later turned into a draft, or into the published post,  
so the ID that you get when you load the add post page, is the ID you  
should get when you publish it..

Cheers
Dion Hulse / dd32

Contact:
  e: contact at dd32.id.au
  msn: msn at d32.id.au
  skype: theonly_dd32
  Web: http://dd32.id.au/


More information about the wp-hackers mailing list