Viewing 7 replies - 16 through 22 (of 22 total)
  • I did, thank you!

    anyakaats

    (@anyakaats)

    I would like to disable the Pin it button on a page that features an image gallery. Is there a code to disable an entire page, not just a single image? I change out the images on the page frequently.

    vincentjflorio

    (@vincentjflorio)

    anyakaats,

    I’m not the plug-in author, but I did make that snippet above to target some things but not others.

    Does the page in question have its own class? “Home” is built into most themes, as is “blog” and “single,” and most Genesis themes allow for you to very easily add one on a per-post or per-page basis.

    Otherwise, you might want to lean on the container for the specific content, which may be something like “#gallery-1” if it’s a default WordPress gallery.

    Either way, I am reasonably sure you can adapt what I wrote above to have a “not” selector in jQuery to deliberately avoid certain parts of the page, like this:

    jQuery("body.home * img").attr("nopin", "nopin");

    turning into this

    jQuery("body.home * img:not(#gallery-1 dl dt a img)").attr("nopin", "nopin");

    or

    jQuery("body:not(.gallery-page) * img").attr("nopin", "nopin");

    I may have a chance to test this tomorrow when I get back to work, otherwise it may be worth a try unless someone comes around to correct it, if need be.

    Plugin Author weblizar

    (@weblizar)

    Thanks Vincent and appreciates to help other user.

    Hope that code will work for cvhall92.

    Thanks

    geminichime

    (@geminichime)

    xchellerodriguez Thank you so much for this!!!!!! You saved my brain lol it worked for me!!

    Thank you vincentjflorio! Your solution works brilliantly. I just added this code to my functions.php file to remove the pin-it button from anything that I assign the “nopin” class. My theme allows adding classes to blocks of content very easily so I find this to be a very elegant solution.

    /* control appearance of Pinit button */
    add_action('wp_head', 'no_pin_outside_of_content');
    
    function no_pin_outside_of_content() { ?>
    
         <script type="text/javascript">
    
         jQuery(document).ready(function() {
    
              jQuery(".nopin * img").attr("nopin", "nopin");
         });
    
        </script>
    <?php }
    Plugin Author weblizar

    (@weblizar)

    You guys doing great, this will be helpful for other users too.

    Thanks

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Remove Button from single picture’ is closed to new replies.