Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to disable the Pinterest Pin It button

When users hover over images in Envira Gallery, browser extensions such as Pinterest’s “Pin It” button can overlay the images, prompting users to pin the content. If you prefer to maintain a clean, distraction-free aesthetic or discourage pinning, you might want to disable this feature. This tutorial walks you through how to prevent Pinterest buttons from appearing when users hover over your gallery images.

Heads up!
This guide involves PHP customizations aimed at altering how social media interaction overlays work in Envira Gallery. We provide this code as a courtesy and do not offer support for customizations or third-party development.

Adding the Code Snippet

To disable the Pinterest “Pin It” button from appearing over images on hover, you can implement a straightforward code snippet. Follow the instructions in this document to add custom PHP code safely to your WordPress site.

Here’s the code snippet you’ll need:

/* Envira - Disable Pinterest Button on Image Hover
* 
* @link https://enviragallery.com/docs/how-to-disable-pinterest-pin-it-button-browser-extension/
*/

function envira_disable_pinterest_button( $atts, $id, $item, $data, $i ) {
return $atts . \'nopin=\"nopin\"\';
}
add_filter( \'envira_gallery_output_image_attr\', \'envira_disable_pinterest_button\', 10, 5 );
add_filter( \'envira_albums_output_image_attr\', \'envira_disable_pinterest_button\', 10, 5 );

By implementing this customization, you can maintain complete control over how your images are shared, preserving the integrity and style of your Envira Gallery. This is particularly useful for photographers and artists looking to curate a specific viewer experience.

And that’s it, you’re all done! Would you like to try some more cool things with Envira? Check out our tutorial on How to Style Pagination Links.


A: Yes, the above code will disable the Pin It button for both galleries and albums.