Support » Plugin: AddToAny Share Buttons » How to change URl to share dynamically?

  • Resolved jstneti



    We’re using the a2a_config.templates.twitter, facebook, linkedin, email and pinterest to define the content for sharing.
    I need to set the URL dynamically because the URL changes with user interaction.

    And also, how do I se the image for Pinterest this way?

    If you could give me a fast answer to how I could achieve this, it would be great. We’re going live in 2 days.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Nevermind.

    I managed to change the link somehow. To all but to Pinterest. How do I set the URL for Pinterest.

    Plugin Author micropat


    Pinterest pulls images directly from the current page by default.

    To point to a specific image, you can use a shortcode, for example:

    [addtoany buttons="pinterest" media=""]

    Or use PHP:

    <?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { 
        ADDTOANY_SHARE_SAVE_KIT( array( 
            'buttons'   => array( 'pinterest' ),
            'linkmedia' => '',
        ) );
    } ?>


    I know how to do that. But we want to dynamically assign the media via JS, like we define titles and texts. Is there any way of doing this?

    Plugin Author micropat


    Yes, use AddToAny events to modify the media like:

        share: function(data) {
   = ''
            return data;

    I’m also looking to set a pinterest image on posts and pages. Which method above is best for doing this? I also have a shop if that matters. This is my only issue with this plugin. Otherwise, it’s great. Thanks.

    • This reply was modified 1 year, 1 month ago by  GloriaT8.
    Plugin Author micropat


    @gloriat8 That varies between sites. Details and options here for a similar site:

    Enabling AddToAny image sharing is the quickest & easiest way to share a single image to Pinterest.

    Using the “Additional JavaScript” example can apply to all your existing AddToAny Pinterest buttons, but it requires knowing the “CSS selector” for the image you want shared (i.e. .woocommerce-product-gallery img.wp-post-image).

    Post a new topic with a link to your site if you need help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to change URl to share dynamically?’ is closed to new replies.