Hello,
Thank you very much for your plug-in, it is working fine to import the posts and the images associated with them but I'd like to know if it would be possible to make it retrieve the click-through urls associated with the photo posts' images (aka {Linkurl}) into a custom field.
Thanks!
http://wordpress.org/extend/plugins/tumblr-importer/
The click-through url is being attached as a click-through link to the image on the post contents inside WordPress which is generated automatically with the caption on bottom so it should be simply a matter of getting the url and pasting it like the rest:
add_post_meta( $id, 'tumblr_'.$this->blog[$url]['name'].'_id', $post['tumblr_id'] );
Maybe like this:
add_post_meta( $id, 'tumblr_'.$this->blog[$url]['name'].'_src', $post['src'] );
?
Okay, I managed to figure it out, I'll leave it here if someone wants to do this:
Add:
$post['tumblr_src'] = (string) $tpost->{'photo-link-url'};
Below:
$post['tumblr_url'] = (string) $tpost['url-with-slug'];
and...
Add:
add_post_meta( $id, 'tumblr_'.$this->blog[$url]['name'].'_src', $post['tumblr_src'] );
Below:
add_post_meta( $id, 'tumblr_'.$this->blog[$url]['name'].'_id', $post['tumblr_id'] );
A better way to save that data would be in the handle_sideload function. In the image case, before the wp_update_post is called, you can do something like this:
if (!empty($link))
add_post_meta( $post->id, 'tumblr_'.$this->blog[$url]['name'].'_src', $link );
Hi Otto,
Thanks, I will use that solution instead!
Maybe you can include that on the next version of the plug-in, lots of users on Tumblr reblog photos from outer sources so this could come in handy for them.
Take care!