Support » Plugin: AddToAny Share Buttons » How to share a single image with addtoany?

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


    To support Open Graph metadata, you need a permalink for each image. Otherwise, just apply named anchors like #photo-12.

    Then with jQuery, insert this HTML, for example, to share a link to the image:

    <div class="a2a_kit a2a_kit_size_32 addtoany_list" data-a2a-url="" data-a2a-title="Photo 12">
        <a class="a2a_button_facebook"></a>
        <a class="a2a_button_twitter"></a>
        <a class="a2a_button_pinterest"></a>
        <a class="a2a_dd" href=""></a>

    Then call a2a.init('page') to initiate those buttons.

    Hi Pat
    thanks for the bright explanation that is pretty clear
    about this :

    2Then call a2a.init(‘page’) to initiate those buttons. “

    I am not sure where i have to call it sorry
    but thanks for your advice

    Plugin Author micropat


    a2a.init('page'); is just another line of JavaScript. Place that after the jQuery statement that inserts the HTML.

    Right now you have … appendTo(" .lb-outerContainer ").a2a.init('page'); which should be this instead:

    … appendTo(" .lb-outerContainer ");

    You should also remove this HTML line from both your jQuery statement and from your theme because the plugin already loads page.js:
    <script type="text/javascript" src="//"></script>

    Hi Pat
    I set in the right way , as you suggested
    and it works
    I really appreciated your help:)
    Thank you.
    $(‘<div class=”a2a_kit a2a_kit_size_32 addtoany_list” data-a2a-url=”″ data-a2a-title=”Photo 12″> </div>’).appendTo(” .lb-outerContainer “);


    Hi Pat
    I appreciated your help. if I could get again some help from you would be great

    I got an error coming out in firebug

    ReferenceError: a2a is not defined

    And the image url returned is
    code (I suppose the jquery/js code is ok, otherwise i have to correct that. Anyway , here all

    var share1 = $(“.lb-image”).attr(“src”);

    var share2 = share1.innerHTML;

    var share3 = $(“#imgShared”).attr(“data-a2a-url”, share2);

    var share4 = share3.innerHTML;

    $(‘<div id = “imgShared” class=”a2a_kit a2a_kit_size_32 addtoany_list” data-a2a-url=”‘+ share4 +'” data-a2a-title=”Photo 12″> </div>’).appendTo(” .lb-outerContainer “);




    Plugin Author micropat


    Ah, I see you have a race condition. Given your script, it’s easiest & cleanest to change:



    if ( 'object' == typeof a2a ) a2a.init('page');

    HI Pat
    Sorry…i am learning to use your plugin and sometimes bumpo into other things to review
    as you see
    i have set now the sharing vertically on the left.
    but if you open the gallery page now i have the menu of sharing, working…because i fix my js script.
    there are 2 questions and one issue
    1. the menu that i add with jquery to the image at the bottom, works only for the first line of buttons, not the one shared from the universal sharing button. because i only added the variable to the meta data of the first 3 buttons. not the others. how to do add alos for the other sharings?
    2. second option, i could remove the menu that i added at the bottom of each image in the gallery, and leave only the one in default , positioned vertically at the left, sharing the single image with that vertical menu,. is this feasible?

    sorry again for all these questions.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to share a single image with addtoany?’ is closed to new replies.