Jando
Jando

Reputation: 359

Pinterest link on wordpress gives error

I am trying to add a pinterest link to my wordpress site. Here on stackoverflow I found the following code:

    <?php 
    /*Stuff for Pinterest*/
    //getting the permalink
    $postpermalink = urlencode( get_permalink() );
    //getting the thumbnail
    $imageurl = urlencode( wp_get_attachment_url( get_post_thumbnail_id($post->ID) ) );
    /*End of Pinterest*/
?>
<a target="blank" href="http://pinterest.com/pin/create/button/?url=<?php echo $postpermalink ?>&media=<?php echo $imageurl ?>" title="Pin This Post">pinterest</a>

But when I test it, pinterest gives me the following error:

Whoops! Parameter 'method' (value link) is not one of unknown, uploaded, scraped, bookmarklet, email, iphone, button, ipad, android, android_tablet, api_sdk, extension, api_other, bad.

I've tried tons of different links, but without success. Any ideas?

Upvotes: 1

Views: 1057

Answers (2)

Dave Finton
Dave Finton

Reputation: 21

According to this resource at pinterest, you'll need to include the pinit.js javascript link somewhere in the page or otherwise the pin-it link will not work (I ran into this very same problem today):

https://developers.pinterest.com/pin_it/

The downside of doing it this way is that if you had any custom graphics or text inside your link, those will be overwritten by the javascript code, and I can't find a way to override this behavior at this time. I'm bookmarking this page in the hopes that someone found or will find some magic way to override the pinterest override.

Upvotes: 1

user3167160
user3167160

Reputation: 71

Try this

/*Stuff for Pinterest*/
//getting the permalink
$postpermalink = urlencode( get_permalink() );
//getting the thumbnail
$imageurl = urlencode( wp_get_attachment_url( get_post_thumbnail_id($post->ID) ) );
/*End of Pinterest*/

echo '<a target="blank" href="http://pinterest.com/pin/create/button/?url=' . $postpermalink . '&amp;media=' .  $imageurl . '" title="Pin This Post">pinterest</a>';

Upvotes: 0

Related Questions