Let users select which Pinterest image to pin

Shared Counts is focused on privacy and performance. We don’t load any third party scripts because they could be used for tracking your site’s visitors and could slow down the speed of your site.

When a visitor clicks the Pinterest button from Shared Counts, they are taken directly to Pinterest.com with the Pinterest image pre-selected. We use the post’s featured image by default, but you can select a different image using the Shared Counts – Pinterest Image extension.

An alternative method is to use the Pinterest JS on the site to let users select which image they would like to pin. We may build this as a feature in the Pinterest Image extension at some point, but for now you can add this functionality by loading this JavaScript file in your theme, or merge the code into your theme’s global JavaScript file.

	$(document).ready( function() {
		$('.shared-counts-button.pinterest').click( function(e) {


			var elem = document.createElement('script');
			elem.setAttribute('type', 'text/javascript');
			elem.setAttribute('charset', 'UTF-8');
			elem.setAttribute('src', 'https://assets.pinterest.com/js/pinmarklet.js');

});Code language: JavaScript (javascript)

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.