Limit AddThis to just main loop, not custom WP_Query in footer
-
The AddThis plugin correctly adds the Share-Buttons to the end of my posts, as expected. But they ALSO display in my site footer, which is populated by a custom WP_Query call in my footer.php template file.
I tried using a hook to disable display of the Share buttons for any post-type other than ‘post’, using this –
add_filter('addthis_post_exclude', 'addthis_post_exclude'); function addthis_post_exclude($display) { global $post; if( get_post_type($post->ID) != 'post' ){ $display = false; } return $display; }
but it didn’t solve the problem — the Share-Buttons still display incorrectly in the footer on a post page.
So it seems the AddThis plugin does not actually limit itself to the loop — it also goes into any custom WP_Query on the page.
Seems like a bug. Any solution?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Limit AddThis to just main loop, not custom WP_Query in footer’ is closed to new replies.