Last active
August 21, 2017 04:43
-
-
Save elvismdev/d776e443c396360b45fb617589ac9395 to your computer and use it in GitHub Desktop.
WordPress AddThis plugin (v6+) - Output and control programmatically the AddThis floating sidebar with it's "Smart Layers API": https://www.addthis.com/academy/smart-layers-api/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Output an AddThis floating share sidebar to the left with selected services. | |
* | |
* Notice 'desktop' and 'mobile' parameters, they take a Boolean data type as value, meaning it can be used to | |
* allow a more dynamic control and display of the sharing sidebar. | |
* | |
* More options to play with can be found here in the docs: https://www.addthis.com/academy/smart-layers-api/ | |
* Just notice to convert the JSON format in the examples to PHP's array() format | |
* to add/change it's settings and display options. | |
*/ | |
add_filter( 'addthis_layers_array', function ( $addthis_layers ) { | |
$addthis_layers = array( | |
'share' => array( | |
'position' => 'left', | |
'services' => 'twitter,facebook,linkedin,email', | |
'desktop' => true, | |
'mobile' => false | |
) | |
); | |
return $addthis_layers; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment