• Resolved Alex

    (@alexhigh)


    Hi, I just discovered your plugin after trying (and failing) to get my old wordpress posts to publish to tumblr with SNAP and Jetpack.

    Everything seems to work pretty great from what I can tell but I have a slight issue. I’d prefer the option to have the tumblr image click through go to the wordpress post rather than image source. Possible?

    Let me know.
    Thanks, Alex

    https://www.ads-software.com/plugins/tumblr-crosspostr/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Meitar

    (@meitar)

    Yes, that’s simple to do. Just edit your post so that the image is a link to your WordPress post. Whatever your image links to is what Tumblr Crosspostr will use as the click-thru link on the image on Tumblr’s side.

    Hope this helps.

    Thread Starter Alex

    (@alexhigh)

    Ahh ok, thanks for getting back so quick.

    Problem is I have hundreds of posts and the way my wordpress theme is setup I just have the source by default on my single post page. Do you suppose there is a way to edit my theme files so that the link is automatically supplied? I’ve looked into doing this in the past when I was trying to get a lightbox to work but couldn’t pull it off..

    I have this in my functions.php that automatically converts uploaded images into posts:

    function myprefix_change_afip_post_content( $post_content, $attachment_id ) {
    
        $my_uploaded_image = wp_get_attachment_image_src( $attachment_id );
        $post_content .= '<img src="' . $my_uploaded_image[0] . '">';
        return $post_content;
    }

    And this seems the relevant bit in Image Attachment Template (image.php):

    <div class="big_image">
    				  <?php echo wp_get_attachment_image( $post->ID, 'large' ); ?>
    				  <p class="caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?></p>
            </div>

    I feel bad for asking as this isn’t your responsibility but I’m going to be stuck otherwise so I’d appreciate any help!

    Plugin Author Meitar

    (@meitar)

    Well, unfortunately, I can’t really know what your code is doing since there’s very little context. All I can suggest is that you make the image in the post a link to the post rather than just an image.

    In the snippets you show above, that might look like changing the line that starts with $post_content .= to include HTML that supplies a link (standard <a href="…">). And it’s probably a good idea to supply an alt attribute for your image, since it’s technically broken code without one.

    But again, that kind of programmatic customization is pretty far beyond the scope of what I can offer any real support for with the plugin. Sorry. :/

    Thread Starter Alex

    (@alexhigh)

    Ok thanks for your help, that’s the bit I was just looking at myself actually so I’ll look into finding the proper code customization to get that bit working.

    Thanks again.
    Alex

    Plugin Author Meitar

    (@meitar)

    Okay. Also remember that your template is constructed after your post is saved to the database, which is when Tumblr Crosspostr acts. If you’re just changing your template, it won’t have any effect on Tumblr because Tumblr doesn’t (and shouldn’t) know anything about your template. If you’re making changes programmatically, you need to do so early in the save_post action hook so that whatever content you supply is visible to Tumblr Crosspostr to send over to Tumblr.

    If you’re curious, the lines of code in the plugin that set the click-thru link are lines 650 through 665.

    Good luck.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Image click-through adjustment’ is closed to new replies.