• Resolved Wouters

    (@wouters)


    Hi, first off excellent plugin. I’ve used the free version on more that one site so far. I have a plugin for my social media share buttons but this is called upon by using a shortcode. <?php echo do_shortcode('[addtoany]'); ?> but this doesn’t work with the repeater. Is there some other way to make this work?

    • This topic was modified 6 years, 10 months ago by Wouters.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @wouters,
    I just tested the plugin and I have it somewhat working using the following template:

    <article>
      <?php 
        global $post;
        echo do_shortcode('[addtoany url="' . get_permalink($post->ID) . '"]'); 
      ?>
      <h2><?php the_title(); ?>
    </article>

    When I inspect the rendered HTML, the share services are there but the images (SVGs) are not showing up.

    ** EDIT **
    I removed the code in this area as it appears the fix I thought was working was actually not a fix.

    I suggest you reach out the developers in their Support Forum and ask them if they can provide any insight on this issue with admin-ajax.

    Hope this helps.

    • This reply was modified 6 years, 10 months ago by Darren Cooney. Reason: fix wasn't actually a fix
    Plugin Author Darren Cooney

    (@dcooney)

    OH! I GOT IT!

    You need to use the almComplete callback function to trigger the init_all function of AddToAny.

    The following JavaScript is what i used to solve this.

    jQuery(document).ready(function($) {   
       
       $.fn.almComplete = function(alm){
          if(window.a2a_config){      
             a2a.init_all("page"); // Trigger AddToAny
          }
       }
       
    });
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add echo do_shortcode in repeater’ is closed to new replies.