Thesaurus

A Web Design & Development Blog

Pinning

Pinterest Pinning…?

Not exactly something I had anticipated doing, but i was asked so i gave it a go. Pinterest provides some good tools for pinning a single image that is directed to a single page. What I needed to do was to have the pinterest pin on the featured image, that was on the blog page, link to that featured images’s single post page.

Here is the code:

                         
  <a 
    href="//www.pinterest.com/pin/create/button/?url=<?=the_permalink();?>&media=<?=$featuredImage?>&description=<?=the_title();?>" 
    data-pin-do="buttonPin" data-pin-config="above" >
                

The href and following media query is separated into lines for readability. You can find the unbroken string below in the source code. The url is followed by the function for the permalink, the media query is followed by the function for the featured image, then the description query is followed by the function for the title. The data attributes are for the pinterest api.

Lots of trail and error, and searching for this, so hope it is helpfull. Pat Eason’s website is where i finally found the last piece of the puzzle


Tags: , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *