WordPress.org

Ready to get started?Download WordPress

Forums

Pinterest non-plugin: show pin count (4 posts)

  1. kaplan
    Member
    Posted 1 year ago #

    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 page

    After 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="http://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

  2. aksello
    Member
    Posted 1 year ago #

    I cant get it to work. Could it be because i put " target="_blank" in the end? Check out my site and see if you get it to work: HERE
    always-show-count="true" count-layout="horizontal" target="_blank"

  3. kaplan
    Member
    Posted 1 year ago #

    hi aksello,

    at some point I want to say I had a 0 (zero) showing, but I think Pinterest has changed the way they handle the 0 count, by not showing it so maybe including that attribute doesn't do anything now. pinterest also changed the style of the pointer box, i have a feeling they did both of those things at the same time.

    on the site i used pinterest on doesn't show any of the 0 pins. http://kerrygoldusa.com

    on the other hand, i pinned one of the photos on your link and don't see the pin count increasing yet.

    i think you can remove the target="_blank" too, seems like it's automatic.

  4. alesub
    Member
    Posted 1 year ago #

    I can confirm that adding always-show-count="true" works. Could it be that you're having a js problem when including the pinterest js file? Make sure it's right before the [/body] tag.

Topic Closed

This topic has been closed to new replies.

About this Topic