Hi Ajuliano,
The best way to remove it from custom post types would be to use the addthis_post_exclude filter. You could do something along the lines of:
add_filter('addthis_post_exclude', 'my_addthis_post_exclude_filter');
function my_addthis_post_exclude_filter($display)
{
if ( 'my_custom_post_type' == get_post_type() )
$display = false;
return $display;
}
Hey Aaron,
Great fix my man.. works like a charm 🙂
Michael.
This worked for me too, thanks!
I’d note that in my case, the post type I had to use in this scenario was blank (”), as it wasn’t reported by the plugin that created the post type. I say this in case anyone runs into something like this.
Thank you Aaron!
Worked great for me as well.
Although I use switch, because I’ve got multiple post-types to hide it from.
add_filter('addthis_post_exclude', 'my_addthis_post_exclude_filter');
function my_addthis_post_exclude_filter( $display ) {
switch ( get_post_type() ) {
case 'my_post_type_1':
$display = false;
break;
case 'my_post_type_2':
$display = false;
break;
case 'my_post_type_3':
$display = false;
break;
case 'my_post_type_4':
$display = false;
break;
}
return $display;
}
Do you think there’s a better way of doing it?
ajuliano, here’s a much simpler way:
add_filter('addthis_post_exclude', 'my_addthis_post_exclude_filter');
function my_addthis_post_exclude_filter($display)
{
if ( in_array(get_post_type(), array('my_post_type_1', 'my_post_type_2','my_post_type_3','my_post_type_4')) )
$display = false;
return $display;
}
Thank you all for the tip!!
Agnes
(@agneslesagegmailcom)
I found a way to insert a custom style in my template, according to this page:
http://www.addthis.com/blog/2011/03/03/addthis-for-wordpress-plugin-version-2-0-2/#.T6Op0Os5Ld4
I added my style as an array in the plugin file (addthis_social_widget.php)
$addthis_new_styles = array(
'my_style' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_" %s ><a class="addthis_button_facebook"></a><a class="addthis_button_twitter"></a><a class="addthis_button_google_plusone_share"></a><a href="http://www.addthis.com/bookmark.php?v=250&pubid=ra-4fa382503d81907c" class="addthis_button_compact">
<a class="addthis_button_email"></a><a class="addthis_button_print"></a><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a></div>', 'img' => 'toolbox-small.png', 'name' => 'My Style', 'above' => 'hidden ', 'below' => ''
), // My Style
And then added the code manually in the template with my style
<?php do_action('addthis_widget',get_permalink($post->ID), get_the_title($post->ID), 'my_style'); ?>