Support » Plugin: Digg Digg » [Plugin: Digg Digg] Pinterest button only selects featured image thumbnail

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi Ian,

    Great to hear from you and thanks a lot for the heads up on this.

    You are right, there are a few issues with the Pinterest button right now, which is all coming from how Pinterest has setup their button. We’ll definitely try to get in touch with them and see if there is a way we can update the button to work by pulling all pictures in! 🙂

    Leo, Co-Founder

    This plugin here has somehow figured it out and has made a plugin that allows you grab whatever image you want as well not just the thumbnail. Works very well. I hope Digg Digg follows in step soon as I love this plugin 🙂

    replace the “DD_Pinterest” class in digg-digg\include\dd-class.php with following code:

    class DD_Pinterest extends BaseDD{

    const NAME = “Pinterest”;

    const URL_WEBSITE = “”;

    const URL_API = “”;

    const DEFAULT_BUTTON_WEIGHT = “10”;

    const BASEURL = ‘<script type=”text/javascript” src=””></script>’;

    const BASEURL_LAZY = ‘‘;

    const BASEURL_LAZY_SCRIPT = “function loadPinterest_POST_ID(){ jQuery(document).ready(function(\$) { \$.getScript(‘’); }); }”;

    const SCHEDULER_LAZY_SCRIPT = “window.setTimeout(‘loadPinterest_POST_ID()’,SCHEDULER_TIMER);”;

    const SCHEDULER_LAZY_TIMER = “1000”;

    const OPTION_APPEND_TYPE = “dd_pinterest_appendType”;

    const OPTION_BUTTON_DESIGN = “dd_pinterest_buttonDesign”;

    const OPTION_BUTTON_WEIGHT = “dd_pinterest_button_weight”;

    const OPTION_AJAX_LEFT_FLOAT = “dd_pinterest_ajax_left_float”;

    const OPTION_LAZY_LOAD = “dd_pinterest_lazy_load”;

    var $buttonLayout = array(

    “Normal” => “vertical”,

    “Compact” => “horizontal”,

    “No Count” => “none”


    var $buttonLayoutLazy = array(

    “Normal” => “vertical”,

    “Compact” => “horizontal”,

    “No Count” => “none”


    public function DD_Pinterest() {

    $this->option_append_type = self::OPTION_APPEND_TYPE;

    $this->option_button_design = self::OPTION_BUTTON_DESIGN;

    $this->option_button_weight = self::OPTION_BUTTON_WEIGHT;

    $this->option_ajax_left_float = self::OPTION_AJAX_LEFT_FLOAT;

    $this->option_lazy_load = self::OPTION_LAZY_LOAD;

    $this->baseURL_lazy = self::BASEURL_LAZY;

    $this->baseURL_lazy_script = self::BASEURL_LAZY_SCRIPT;

    $this->scheduler_lazy_script = self::SCHEDULER_LAZY_SCRIPT;

    $this->scheduler_lazy_timer = self::SCHEDULER_LAZY_TIMER;

    $this->button_weight_value = self::DEFAULT_BUTTON_WEIGHT;

    parent::BaseDD(self::NAME, self::URL_WEBSITE, self::URL_API, self::BASEURL);


    //construct base URL, based on $lazy value

    public function constructURL($url, $title, $button, $postId, $lazy, $globalcfg = ”){

    //rawurlencode – replace space with %20

    //urlencode – replace space with +

    if($this->isEncodeRequired) {

    $title = rawurlencode($title);

    $url = rawurlencode($url);


    if($lazy==DD_EMPTY_VALUE || $lazy==false){

    $this->constructNormalURL($url, $title,$button, $postId);


    $this->constructLazyLoadURL($url, $title,$button, $postId);



    public function getFirstPostImage($postId){
    //Get url of img and compare width and height

    $post = get_post($postId);

    $output = preg_match_all( ‘/<img.+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches );

    $first_img = $matches [1] [0];

    return $first_img;


    public function constructNormalURL($url, $title,$button, $postId){

    $finalURL = $this->baseURL;

    $finalURL = str_replace(self::VOTE_BUTTON_DESIGN,$this->getButtonDesign($button),$finalURL);

    $finalURL = str_replace(self::VOTE_TITLE,$title,$finalURL);

    $finalURL = str_replace(self::VOTE_URL,$url,$finalURL);

    $finalURL = str_replace(parent::POST_ID,$postId,$finalURL);

    $finalURL = str_replace(parent::VOTE_TITLE,$title,$finalURL);

    $finalURL = str_replace(parent::VOTE_URL,$url,$finalURL);

    if(current_theme_supports(‘post-thumbnails’)) $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($postId), ‘thumbnail’ );

    else $thumb = false;

    $image = $thumb[0];
    $image = $this->getFirstPostImage($postId);
    /*echo “<script>alert(‘”.$image.”‘);</script>”;*/

    $finalURL = str_replace(parent::VOTE_IMAGE,$image,$finalURL);

    $this->finalURL = $finalURL;


    public function constructLazyLoadURL($url, $title,$button, $postId){

    $finalURL_lazy = $this->baseURL_lazy;

    $finalURL_lazy = str_replace(parent::VOTE_BUTTON_DESIGN,$this->getButtonDesignLazy($button),$finalURL_lazy);

    $finalURL_lazy = str_replace(parent::POST_ID,$postId,$finalURL_lazy);

    $finalURL_lazy = str_replace(parent::VOTE_TITLE,$title,$finalURL_lazy);

    $finalURL_lazy = str_replace(parent::VOTE_URL,$url,$finalURL_lazy);

    if(current_theme_supports(‘post-thumbnails’)) $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($postId), ‘thumbnail’ );

    else $thumb = false;

    $image = $thumb[0];
    $image = $this->getFirstPostImage($postId);
    /*echo “<script>alert(‘LAZY’);</script>”;*/
    $finalURL_lazy = str_replace(parent::VOTE_IMAGE,$image,$finalURL_lazy);

    $this->finalURL_lazy = $finalURL_lazy;

    $finalURL_lazy_script = $this->baseURL_lazy_script;

    $finalURL_lazy_script = str_replace(parent::VOTE_TITLE,$title,$finalURL_lazy_script);

    $finalURL_lazy_script = str_replace(parent::VOTE_URL,$url,$finalURL_lazy_script);

    $finalURL_lazy_script = str_replace(parent::POST_ID,$postId,$finalURL_lazy_script);

    $this->finalURL_lazy_script = $finalURL_lazy_script;

    $final_scheduler_lazy_script = $this->scheduler_lazy_script;

    $final_scheduler_lazy_script = str_replace(parent::SCHEDULER_TIMER,$this->scheduler_lazy_timer,$final_scheduler_lazy_script);

    $final_scheduler_lazy_script = str_replace(parent::POST_ID,$postId,$final_scheduler_lazy_script);

    $this->final_scheduler_lazy_script = $final_scheduler_lazy_script;



    ^^^ this will pull the first image of the post if thumb is not available

    Ian, thanks for posting this. I also have seen other plugins working by giving the user the choice of the pictures within the post. The current process of pulling the WP Featured Thumbnail is really ineffective. I hope this one gets updated soon. Thanks!

    To make it select full image, not a thumbnail, do next:
    1. Go to Plugins->editor
    2. Select plugin to edit: Digg Digg
    3. Select file digg-digg/include/dd-class.php
    4. Find next strings:

    if(current_theme_supports(‘post-thumbnails’)) $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($postId), ‘thumbnail’ );

    5. There is 2 of them, replace both with next string:

    if(current_theme_supports(‘post-thumbnails’)) $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($postId), ‘full’ );

    6. Update file
    7. Enjoy

    Plugin Author Andrew Yates


    Thanks again AlphaUA, i’m looking at improving the image selection for sharers that require images. This will be coming in a future update and will hopefully allow users to select which post thumbnail size to send.

    I submit this plugin into my [ link removed ] Blog. and it is working fine

    you are right @ronnydavis, it is great plugin for social media. google is preferring to it

    thanks for it asad

    Great @alphaua

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: Digg Digg] Pinterest button only selects featured image thumbnail’ is closed to new replies.