Support » Plugin: Sharebar » [Plugin: Sharebar] A shortcode for post image thumbnail

  • It will be great if you could add a shortcode like [thumbnail] for the Sharebar plugin to manage the post image thumbnail call: wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘thumbnail’ )

    So, by just writing [thumbnail] we get the thumbnail url. Very usefull to embed buttons like “Pin it” from Pinterest that requieres an image url to be pinned.

    Thanks for your time!

    http://wordpress.org/extend/plugins/sharebar/

Viewing 1 replies (of 1 total)
  • It could work by just adding this update to your plugin source code (on sharebar_filter function):

    function sharebar_filter($input){
    global $post;
    $code = array(‘[title]’,'[url]’,'[author]’,'[twitter]’,'[thumbnail]’);

    $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘large’ );
    $urlThumb = $thumb[‘0’];

    $values = array($post->post_title,get_permalink(),get_the_author(),get_option(‘sharebar_twitter_username’),$urlThumb);
    return str_replace($code,$values,$input);
    }

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Sharebar] A shortcode for post image thumbnail’ is closed to new replies.