Title: Filtering Issue
Last modified: August 9, 2017

---

# Filtering Issue

 *  [insidethepark](https://wordpress.org/support/users/insidethepark/)
 * (@insidethepark)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/filtering-issue-2/)
 * I am trying to add code to my functions.php to allow addthis to show up on specific
   pages. According to the documentation, the filters in the 6.0 version have changed.
 * My quick and dirty filter example to disable on all pages does not seem to work:
 *     ```
       add_filter('addthis_sharing_buttons_enable', 'my_addthis_sharing_buttons_enable');
       function my_addthis_sharing_buttons_enable($enable) {
         return false;
       }
       ```
   
 * When I enable this, the addThis buttons still appear on every page. Shouldn’t
   this example hide the share buttons on every single page, or am I misunderstanding
   the filter?
 * Thanks for your help!
    -  This topic was modified 8 years, 10 months ago by [insidethepark](https://wordpress.org/support/users/insidethepark/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Contributor [Julka Grodel](https://wordpress.org/support/users/jgrodel/)
 * (@jgrodel)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9396350)
 * Hi insidethepark.
 * Thanks for reaching out to us with your issue.
 * I believe your assumption here is correct and I will take a deeper looking into
   it. In the meantime, do you have a URL you could share with us that has buttons
   showing up where you don’t expect them to? It would help with the troubleshooting.
 * One other thing to consider is caching. If you’re using any caching plugins, 
   you might want to clear their caches after adding in this code in order to see
   the changes on the page.
 * Thanks,
    Julka
 *  Thread Starter [insidethepark](https://wordpress.org/support/users/insidethepark/)
 * (@insidethepark)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9396362)
 * Hi Julka,
 * The development is happening on my local machine, so I don’t have a publicly 
   available URL yet.
 * I can confirm there is no caching occuring on the local site.
 * Thanks!
 *  Plugin Contributor [Julka Grodel](https://wordpress.org/support/users/jgrodel/)
 * (@jgrodel)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9398788)
 * Hi insidethepark.
 * I tried your code in the functions.php file of the active theme (twentyseventeen)
   in a clean WordPress install. It worked as expected, with buttons above and below
   posts (both on the pages for the posts and excerpts for the posts) disappearing.
 * Have you done some troubleshooting to make sure your code is executing, like 
   an error_log or echo right above where you’re defining your filter?
 * Thanks,
    Julka
    -  This reply was modified 8 years, 10 months ago by [Julka Grodel](https://wordpress.org/support/users/jgrodel/).
 *  Thread Starter [insidethepark](https://wordpress.org/support/users/insidethepark/)
 * (@insidethepark)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9399556)
 * Hi Julka,
 * I can confirm the filter works when the display is set to top/bottom of the page.
   However, I am using the Sidebar display, and the filters do not seem to work 
   on that. Is there a filter for the sidebar?
 * Thanks!
 *  Plugin Contributor [Julka Grodel](https://wordpress.org/support/users/jgrodel/)
 * (@jgrodel)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9399638)
 * Hi insidethepark.
 * No, unfortunately, there are no filters for that.
 * Depending on your mode, you’ll see one of two things when editing the sharing
   sidebar. There will either be an **Advanced Settings** section in the Sidebar
   configurations where you can define URL patterns on which to hide that tool, 
   or a **Templates** section with options like homepage, pages, post, categories.
 * Thanks,
    Julka
 *  [Elvis Morales](https://wordpress.org/support/users/elvismdev/)
 * (@elvismdev)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9426073)
 * [@jgrodel](https://wordpress.org/support/users/jgrodel/), Is there a filter we
   can use to programmatically alter the display options under **Templates** section(
   homepage, pages, post, categories), instead of having those to be dictated from
   the backend UI configuration page only?
 * For instance, I would like to display the Sidebar Floating Shares on certain 
   post detail pages, not all of them, and I’d like to dynamically control this 
   from functions.php using ideally a WP filter.
 * Looking at the [filters docs](https://plugins.svn.wordpress.org/addthis-all/trunk/documentation.filters.md)
   I’m not quite sure which should I follow for that.
 *  [Elvis Morales](https://wordpress.org/support/users/elvismdev/)
 * (@elvismdev)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9426180)
 * NVM, I resolved this using `addthis_layers_array` filter to conditionally output
   the share floating sidebar anywhere I need it.
 * e.g.
 *     ```
       add_filter( 'addthis_layers_array', function ( $addthis_layers ) use ( $post ) {
   
       	if ( $post->my_custom_field == 'my_value' ) {
   
       		$addthis_layers = array(
       			'share' => array(
       				'position'  => 'left',
       				'services'  => 'twitter,facebook,linkedin,email'
       				)
       			);
   
       	}
   
       	return $addthis_layers;
       });
       ```
   
 * More info at this gist: [https://gist.github.com/elvismdev/d776e443c396360b45fb617589ac9395](https://gist.github.com/elvismdev/d776e443c396360b45fb617589ac9395)
    -  This reply was modified 8 years, 9 months ago by [Elvis Morales](https://wordpress.org/support/users/elvismdev/).
    -  This reply was modified 8 years, 9 months ago by [Elvis Morales](https://wordpress.org/support/users/elvismdev/).

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Filtering Issue’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/addthis_70cced.svg)
 * [WordPress Share Buttons Plugin – AddThis](https://wordpress.org/plugins/addthis/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/addthis/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/addthis/)
 * [Active Topics](https://wordpress.org/support/plugin/addthis/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/addthis/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/addthis/reviews/)

## Tags

 * [configuration](https://wordpress.org/support/topic-tag/configuration/)

 * 7 replies
 * 3 participants
 * Last reply from: [Elvis Morales](https://wordpress.org/support/users/elvismdev/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/filtering-issue-2/#post-9426180)
 * Status: not resolved