Support » Fixing WordPress » Share on Tumblr button for posts, not pages?

  • Hi all,

    Tumblr’s current ‘Share to tumblr’ button is, as I understand it, made to share PAGES, not posts. Anyone have a workaround for this?

    I want visitors of my new wordpress site to be able to share pictures to tumblr. The post to tumblr should be a picture post, using the ‘feature image’. It should include a click-through, source, and the text from within the post.

    It sounds easy enough to share the ‘feature image’ from a wordpress post to tumblr. The problem here is that if I for example use the code for the tumblr button, and paste it in a post instead of a page, the image and click through doesn’t work. A friend told me to “put the id number from the object in html elementets id-feeld”. Which I have no idea what it means or how to do.

    Is someone skilled enough to modify Tumblr’s ‘share to tumblr’* button to work with posts? (and thereby preserve the click-through and source)

    Here is the code for Tumblr’s button :

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <!-- Set these variables wherever convenient -->
    <script type="text/javascript">
        var tumblr_photo_source = "The 'feature image' from the wordpress post";
        var tumblr_photo_caption = "Post title";
        var tumblr_photo_click_thru = "Link to the wordpress post";
    </script>
    
    <!-- Put this code at the bottom of your page -->
    <script type="text/javascript">
        var tumblr_button = document.createElement("a");
        tumblr_button.setAttribute("href", "http://www.tumblr.com/share/photo?source=" + encodeURIComponent(tumblr_photo_source) + "&caption=" + encodeURIComponent(tumblr_photo_caption) + "&clickthru=" + encodeURIComponent(tumblr_photo_click_thru));
        tumblr_button.setAttribute("title", "Share on Tumblr");
        tumblr_button.setAttribute("style", "display:inline-block; text-indent:-9999px; overflow:hidden; width:129px; height:20px; background:url('http://platform.tumblr.com/v1/share_3.png') top left no-repeat transparent;");
        tumblr_button.innerHTML = "Share on Tumblr";
        document.getElementById("tumblr_button_abc123").appendChild(tumblr_button);
    </script>

    /Simon

  • The topic ‘Share on Tumblr button for posts, not pages?’ is closed to new replies.