I am using the_content() in my custom WP_Query, outside the main loop for the page, to display something in the sidebar and footer. So if the AddThis plugin just listens for "the_content()" then it seems like that's a problem with the plugin -- since the_content() can be called multiple times on a page. I have seen this problem on multiple sites now.
I can't give direct access to my wp site. My code is a just a basic use of WP_Query outside the loop.
$args = array(
'post_type' => 'page',
'post__in' => array($page_id)
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php the_content();?>
<?php
endwhile;
wp_reset_postdata(); //reset query
My code works fine -- except that the AddThis buttons insert themselves at the end of the displayed content.
My AddThis settings are-
on the Basic tab:
- Bottom Sharing Tool enabled
- custom button (but the problem persists with other options)
on the Advanced tab:
- show on Homepage, Pages,
- Show analytics in admin dashboard: yes
- nothing else set.
I also posted about this on the AddThis support site, and got no help there.
http://support.addthis.com/customer/portal/questions/3359303-wp-addthis-plugin-inserts-share-buttons-in-wp-query-calls-outside-the-loop