Pinterest non-plugin: show pin count
-
Hi,
I don’t know if this is the best place to do this, but I thought I’d post here just in case anyone else is searching like me for how to show the pin count on a Pin it button when the count is 0. Maybe this is already part of the plugin? But I’m not using the plugin and getting the code for the Pin it button from Pinterest’s Goodies pageAfter quite a bit of searching I landed on a stackoverflow page where one of the comments to the question held the answer, which seems simple enough.
Add this attribute to the pinterest tag: always-show-count=”true” – tehprofessor
So in my social-links.php I have this for Pinterest:
<?php $featureImage = wp_get_attachment_image_src( get_post_thumbnail_id(), 'single-medium-feature'); $permaLink = urlencode( get_permalink($post->ID) ); ?> <a href="https://pinterest.com/pin/create/button/?url=<?php echo $permaLink;?>&media=<?php echo urlencode($featureImage[0]);?>&description=testing" class="pin-it-button" always-show-count="true" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
Then in the footer or just before the closing body tag:
<!--Pinterest--> <script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
I have the description string as “testing”, but I bet using a meta description custom field will work well.
Any advice, suggestions or corrections are appreciated. Thanks!
Dave
- The topic ‘Pinterest non-plugin: show pin count’ is closed to new replies.