• Resolved wherefoodtakesus

    (@wherefoodtakesus)


    I created a data- attribute for my Pinterest image and I was wondering if there’s a way for me to specify the Pinterest share button to use it.

    Example:

    <img src="%image%" alt="%alt-attribute%" data-pin-description="%pin-description%" />

    Thank you for any help you’re able to provide!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author micropat

    (@micropat)

    You can set an AddToAny Template to customize the description parameter like so:

    a2a_config.templates.pinterest = {
        description: 'Image description!',
    };

    Altogether with your current share event handler:

    a2a_config.callbacks.push({
        share: function(data) {
            // Get the main product's image if present on the page
            var image = document.querySelector('.pin-image img');
            var description = image.getAttribute('data-pin-description')
            
            // If sharing to Pinterest and a product image is present
            if ('Pinterest' === data.service && image && image.src) {
                // Set the description parameter
                a2a_config.templates.pinterest = {
                    description: description,
                };
                // Set the shared image to the product image
                return {
                    media: image.src
                };
            }
        }
    });
Viewing 1 replies (of 1 total)
  • The topic ‘Pull custom description for social media sharing’ is closed to new replies.