WordPress.org

Ready to get started?Download WordPress

Forums

Tumblr Importer
Need to retrieve the Linkurl associated with each post (5 posts)

  1. S3nd41
    Member
    Posted 2 years ago #

    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/

  2. S3nd41
    Member
    Posted 2 years ago #

    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'] );
    ?

  3. S3nd41
    Member
    Posted 2 years ago #

    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'] );

  4. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    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 );
  5. S3nd41
    Member
    Posted 2 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic