Pinterest?

I see the update should have pinterest. I have it checked to enable but it is not showing in the floating social bar. Is there something else I need to do?

  • aecnu

    Greetings infinitenothing,

    The reason the Pinterest button is not showing is most likely because the plugin didn't found an image for your post. By default, the plugin will look for the featured image for your post, and use that as Pinterest image.

    If this lookup fails, the plugin will just skip showing the Pinterest button, by default. The solution for this situation could be as easy as adding a featured image to your post. However, there are also some more advanced techniques of dealing with this situation, if the easy solution doesn't fit your scenario.

    If it can't find the featured image to share, the default behavior is to not show the sharing button. Also, both of these behaviors can be relatively easily modified through hooks. If you're comfortable with PHP, I'll include some quick examples here.

    For an example, this will force the Pin button to show, no matter what:

    function fshf_show_pinterest ($show, $atts) {
    	return true;
    }
    add_filter('wdsb-buttons-pinterest', 'fshf_show_pinterest', 10, 2);

    The "wdsb-buttons-pinterest" filter takes 2 arguments - should the button be shown ($show) and an array of button features ($atts). The filter should return a boolean true or false - true meaning the button will be shown.

    This example will force all Pin buttons to share a Hello Kitty image from Wikipedia:

    function fshf_show_image ($image, $size) {
    	return 'http://upload.wikimedia.org/wikipedia/en/thumb/0/05/Hello_kitty_character_portrait.png/200px-Hello_kitty_character_portrait.png';
    }
    add_filter('wdsb-media-image', 'fshf_show_image', 10, 2);

    The "wdsb-media-image" filter also takes 2 arguments - the image found by the plugin (if any), and the size that was being looked for. The filter handling function is expected to return a string, which is the full URL to the image you want to be shared.

    There are some other filters you may want to use to modify the plugin behavior as well - if you wish, you can find them in the file lib/functions.php in the plugin directory.

    Thank you for being a WPMU Dev Member!

    Cheers, Joe

  • James Dunn

    In addition to what Joe said here, if you don't have an image attached as a featured image, then EVEN if it did have a PinIt button and you tried to pin it, then it would not put anything on Pinterest because Pinterest requires an image to be able to pin anything.

    I read an article very recently about that very thing and I couldn't locate it or I would have posted the link here. So, first order of business is to always associate a featured image with anything you put on your website so that people can PinIt. Then, make sure you give them the option to PinIt with the plugin you mentioned.

    JDD

  • infinitenothing

    @aecnu I really appreciate the coding assistance to fix this. However I am more an HTML/CSS guy. I am attaching an image of the files I am able to edit in this plugin. Could you please tell me where to place this?

    @JamesDunn I would initially agree however my personal "Pin It" button on my toolbar allows me to pin every image on the site. So Pinterest should allow visitors to Pin and I never use the featured image part of the editor. I just code images into posts. I do appreciate your input anyway.

  • infinitenothing

    Okay, I think I have found the scripting that controls the pinterest button but it is not listed in the files shown in the image. I had to explore those files to get to sharebox/lib/forms/box_template.php. Anyway, let me paste the exact code so you can show me what I need to edit.

    case "pinterest":
    							$post_id = is_singular() ? get_the_ID() : false;
    							$atts = array();
    
    							$url = wdsb_get_url($post_id);
    							if ($url) $atts['url'] = 'url=' . rawurlencode($url);
    
    							$image = wdsb_get_image($post_id);
    							if ($image) $atts['media'] = 'media=' . rawurlencode($image);
    
    							$description = rawurlencode(wdsb_get_description($post_id));
    							if ($description) $atts['description'] = 'description=' . $description;
    
    							$show = apply_filters('wdsb-buttons-pinterest', !empty($image), $atts);
    							if ($show) {
    								$atts = join('&', $atts);
    								echo '

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.