Add lightweight social sharing buttons.
[share]
shortcode for adding the share buttons within post contentThe [share]
shortcode includes the template from templates/shortcode-share.php
. If you'd like to use a custom template, copy shortcode-share.php
into the templates/
directory in your theme and also implement the following example snippet:
/**
* Custom [share] shortcode template
*/
function custom_roots_share_buttons_template() {
return get_template_directory() . '/templates/shortcode-share.php';
}
add_action('roots/share_template', 'custom_roots_share_buttons_template');
Roots Share Buttons includes one stylesheet. If you'd prefer to implement these styles within your theme (which is recommended), you can remove the plugin assets with this snippet:
/**
* Remove Roots Share Buttons assets
*/
function remove_roots_share_buttons_assets() {
wp_dequeue_style('roots-share-buttons');
}
add_action('wp_enqueue_scripts', 'remove_roots_share_buttons_assets');