Displays share buttons in the posts, pages and custom posts type list
Screenshots
Dadi Shal List Post
FAQ
Can I add custom buttons?
Yes! You can. Simply use shal_buttons filter in your theme functions.php or personal plugin. Example:
add_filter( 'shal_buttons', 'my_callback_function' );
function my_callback_function( $buttons, $post_id ) {
$buttons['SLUG_OF_SOCIAL_BUTTON'] = array(
'url' => 'HERE_URL_FOR_SHARE',
'name' => 'NAME_OF_SOCIAL',
'icon' => 'ICON_CSS_CLASSES_OF_SOCIAL' // this plugin uses socicon - see http://www.socicon.com/
'color' => 'BACKGROUND_COLOR_OF_BUTTON'
);
return $buttons;
}
Can I rewrite entire default button?
Yes! You can. Simply you use shal_buttons filter and rewrite entire button. Example, we rewrite facebook button:
add_filter( 'shal_buttons', 'my_callback_function' );
function my_callback_function( $buttons, $post_id ) {
unset( $buttons['facebook'] ); // unset default facebook button
if( !get_dadishal_options( 'enable_facebook' ) ) return $buttons; // remember to add this conditional tag for enable/disabled new button
$buttons['facebook'] = array( // set new facebook button
'url' => 'HERE_URL_FOR_SHARE',
'name' => 'NAME_OF_SOCIAL', // yes in example will be facebook
'icon' => 'ICON_CSS_CLASSES_OF_SOCIAL' // this plugin uses socicon - see http://www.socicon.com/ ex. socicon socicon-facebook
'color' => 'BACKGROUND_COLOR_OF_BUTTON'
);
return $buttons;
}
I rewrite entire button, and now this button is at the end of buttons.
Yes. You can avoid this problem, editing button for each value without unset button. Example:
add_filter( 'shal_buttons', 'my_callback_function' );
function my_callback_function( $buttons, $post_id ) {
unset( $buttons['facebook']['url'] );
unset( $buttons['facebook']['name'] );
unset( $buttons['facebook']['icon'] );
unset( $buttons['facebook']['color'] );
if( !get_dadishal_options( 'enable_facebook' ) ) return $buttons; // remember to add this conditional tag for enable/disabled new button
$buttons['facebook']['url'] = 'NEW_SHARE_URL';
$buttons['facebook']['name'] = 'NEW_NAME';
$buttons['facebook']['icon'] = 'NEW_ICON_CLASSES'
$buttons['facebook']['color'] = 'NEW_COLOR' // rembember: hex color
return $buttons;
}
Can I edit certain array value of default button
Yes. Simply you use shal_buttons filter and unset chosen element of the array. See example above.
ChangeLog