Add this to functions file to remove AddThis from single Custom Post Type pages.
//Exclude AddThis widgets from anything other than posts
add_filter('addthis_post_exclude', 'addthis_post_exclude');
function addthis_post_exclude($display) {
if ( !is_singular( 'post' ) )
$display = false;
return $display;
}


6 comments

Steve C.Comment added on September 6, 2012 at 3:56 pm
thanks for this!
One snag for me: replacing ‘post’ with my ‘custom_post_type_name’ is removing any Add This instances from the Posts pages.
Can you expound on this snippet?
Thanks in advance.

Melanie DunfordComment added on September 6, 2012 at 4:08 pm
the !is_singular( ‘post’ ) is removing from all that is not post. If you replace with your custom post type, it changes to remove from all that is not custom post type. If you only want to remove from custom post type, change post to post type name and remove the ! (exclamation point) before

JarrodComment added on September 6, 2012 at 4:30 pm
This worked for Steve C’s case that I assisted him with:
add_filter(‘addthis_post_exclude’, ‘addthis_post_exclude’);
function addthis_post_exclude($display) {
global $post;
if( get_post_type($post->ID) == ‘text_sliders’)
$display = false;
return $display;
}
Where ‘text_sliders’ was the slug of his custom post type. The goal was to remove AddThis from being added to slides in a slideshow placed in the site header.
-Jarrod

JarrodComment added on September 6, 2012 at 4:30 pm
Should have wrapped that in code tags:

Steve C.Comment added on September 6, 2012 at 9:13 pm
Yes, thanks Jarrod! That was the ticket… the original code was not showing changes to just the custom post types, but rather to all post types.
Thanks for the quick response originally, Melanie. Hope this tidbit helps build-out your proposed fix(es) for various scenarios.

DanielComment added on October 28, 2012 at 5:17 am
Thanks! It’s work!
What Did You Think?