Filter the sharing display title.
Parameters
- $title
string Sharing service title.
- $id
(string | false) Sharing ID.
- $args
array Array of sharing service options.
- $this
object Sharing service properties.
Changelog
- Introduced in Jetpack 3.4.0
How to use this hook
Notes
You can use this filter to change thetitle parameter of the links for each one of the sharing buttons.
Here is how you could use that filter to change the sharing title depending on the sharing service:
/*
* Customize the sharing title.
*
* @param string $text Sharing service title.
* @param object $sharing_obj Sharing service properties.
* @param int|false $id Sharing ID.
* @param array $args Array of sharing service options.
*/
function jetpack_developer_custom_sharing_text( $text, $sharing_obj, $id, $args ) {
if ( ! empty( $args[1] ) ) {
switch ( $args[1] ) {
case 'Email' :
return esc_html__( 'Email', 'jetpack' );
case 'Facebook' :
return esc_html__( 'Share', 'jetpack' );
case 'Twitter' :
return esc_html__( 'Tweet', 'jetpack' );
}
}
}
add_filter( 'jetpack_sharing_display_title', 'jetpack_developer_custom_sharing_text', 20, 4 );