• Resolved hamsini

    (@hamsini)


    Hi,
    1. How do I add social share icons only to few specific images?
    2. Once people click social icons on image, can they share the target image URL (instead of parent page)?
    Thanks

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author micropat

    (@micropat)

    Hi,

    Check out AddToAny’s WordPress documentation for image sharing.

    Your Additional JavaScript code would be something like this:

    a2a_config.overlays.push({
        // Show share buttons on visible images instead of only on hover over images.
        showOn: 'visible',
        // Show image share buttons only on <img> elements within <figure class="shareable-image"> elements.
        target: '.shareable-image img',
        // Share the image itself instead of the page URL.
        useImage: true,
    });

    Just add the share-image class name to images inserted with the WordPress block editor: Select the image block > Advanced > Additional CSS class(s).

    Thread Starter hamsini

    (@hamsini)

    Hi,
    Are you sure I should add “share-image” as a class and not “shareable-image”? I’m looking at your code, and I think the second option is the right one.

    Plugin Author micropat

    (@micropat)

    Yep, I meant shareable-image. Good catch, and great to see you have it working.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding social icons only to couple of specific images’ is closed to new replies.