Text only Pinterest link

As I’ve said a few times before, I prefer to keep control over the look of the social links that appear on this site. I also prefer to keep control over the source code and have an almost religious fervor against the iframed code bloat most social buttons produce.

So when it came time to add a Pinterest link to the share section, I again went in search of a text-only link. Stack Overflow had a couple of leads which ultimately didn’t work. It was easy enough to get a link to a ‘add pin’ window, but the solutions required that a specific url to an image be added. Pinterest’s ability to scan a page and show all pinnable images was missing.

I eventually came across Jeremy Mansfield’s post: Add a Custom Pinterest Button to your Website (Part 2), which does a great job explaining the crux of the issue, as well as a solid, well thought out solution by Cameron Clark.

I gave Cameron’s solution a try, and can confirm that it did indeed work. I ultimately decided to go the route below for a couple of reasons: 1. I wanted something a bit simpler, that didn’t require another enqueue_script, and 2. This solution shrank the sizes of the images that get pinned and I preferred them at full size.

The final solution I arrived at was to take the Pinterest Bookmarklet and extract the javascript into a text-based link on the site:

<a href='javascript:void((function(d)%7Bvar%20e%3Dd.createElement(%27script%27)%3Be.setAttribute(%27type%27,%27text/javascript%27)%3Be.setAttribute(%27charset%27,%27UTF-8%27)%3Be.setAttribute(%27src%27,%27//assets.pinterest.com/js/pinmarklet.js%3Fr%3D%27%2BMath.random()*99999999)%3Bd.body.appendChild(e)%7D)(document))%3B'><i class="icon-pinterest"></i></a>

As you’ll notice on this site, icon-fonts are used instead of text for these links, but you get the idea.

You’ll also notice the Pinterest icon is missing in the share section below. That’s because I conditionally show it only on Image posts. You can see it in action here.

19 Comments


Excellent beat ! I wish to apprentice while you amend your
website, how could i subscribe for a blog web site?
The account helped me a acceptable deal. I had been
tiny bit acquainted of this your broadcast provided bright clear idea

Reply

Hmm is anyone else having problems with the pictures on this blog loading?
I\’m trying to determine if its a problem on my end or if it\’s the blog.

Any responses would be greatly appreciated.

Reply

The Paleo Diet is not presented as just a diet, but as a lifestyle choice.
Hunting animals and gathering produce from the earth was
the norm. Always check your physician before making any changes to your
daily habits.

Reply

I am genuinely delighted to glance at this weblog posts which carries tons of helpful data, thanks for providing these kinds of information.

Reply

Nice post. I learn something new and challenging on websites I stumbleupon every day.

It will always be helpful to read content from other
authors and practice a little something from other websites.

Reply

These ingredients may not lead to weight loss individually, but they can be quite
effective when used in combination. Likewise, double or triple dosing on something is not going to
give you faster results and in some cases it
can cause paranoia, sweating and dehydration, heart palpitations, restlessness and severe muscle cramping.
Research states that some supplements are really effective for weight loss but consulting
the doctor is still the best move prior to ttaking any supplements.

Reply

Have you ever thought about adding a little
bit more than just your articles? I mean, what you say is fundamental and all.

Nevertheless just imagine if you added some great visuals or video clips to give your
posts more, \”pop\”! Your content is excellent but with images and video clips, this site could definitely be one of the most beneficial in its niche.
Great blog!

Reply

It\’s actually a great and useful piece of info.
I\’m happy that you simply shared this helpful info with us.
Please stay us informed like this. Thanks for sharing.

Reply

Have you ever considered writing an ebook or guest authoring on other sites?
I have a blog based upon on the same information you discuss and would
love to have you share some stories/information.
I know my subscribers would value your work. If you
are even remotely interested, feel free to send me an email.

Reply

Very shortly this web page will be famous among all blogging
and site-building people, due to it’s good content

Reply

Having a contemporary kitchen design will imply that you will spend money on the most stylish kitchen equipments and appliances.
With a nicely matching rustic kitchen design that coordinates your cabinets with everything else, your kitchen
will immediately become your family’s favorite room within the house.
Today kitchens less complicated more dynamic environments to begin with, plus many homes they’re about the
most used room in the house.

Reply

I like what you guys tend to be up too. This kind of clever work
and reporting! Keep up the terrific works guys I\’ve added you guys
to blogroll.

Reply

The right article spinners can generate fairly superior outcomes.
What is write-up re-writing and why do we have to have these rewriters?

Reply

Greetings, I believe your website might be having web browser compatibility problems.
Whenever I take a look at your site in Safari, it looks fine but when
opening in Internet Explorer, it has some overlapping issues.
I simply wanted to give you a quick heads up! Other than that, excellent blog!

Reply

I\’ve been exploring for a bit for any high quality articles or weblog posts on this kind of space .
Exploring in Yahoo I at last stumbled upon this website.
Studying this information So i am happy to exhibit that
I have a very just right uncanny feeling I came upon just what I needed.
I most without a doubt will make sure to don?t
disregard this web site and provides it a glance regularly.

Reply

Exactly what I was looking for. Thank you!

Reply

Leave a Reply

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

Check out our Complete Website Package

Chat with us about your project or click below to find out more!

Learn More   Chat with us

Hi. We are Spigot. Telemarketers pronounce it Spy-got.

We are a Park City, Utah based web design shop that excels at building custom websites powered by WordPress and WooCommerce. We love content - content strategy, content curation, content soup...????Have a look around the site. As you browse you'll find useful navigation links in the sidebar on the left. We hope you find them useful anyway... Please let us know what you think, shoot us a message here.