Created
April 9, 2021 13:50
-
-
Save thecodepoetry/a5c16fe77b833f3bcb5c794ce0946f8b to your computer and use it in GitHub Desktop.
telgram share button
This file contains hidden or 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
add_filter( 'the7_get_share_buttons_list', 'dt_add_sharebtn_callback', 10, 4); | |
function dt_add_sharebtn_callback( $share_buttons, $place, $post_id, $buttons ) { | |
$title = get_the_title($post_id ); | |
$url = get_the_permalink($post_id ); | |
$url = 'https://t.me/share/url?url="'. $url . '"&text=' . $title; | |
$share_buttons[] = array( | |
'id' => 'telegram', | |
'url' => $url, | |
'name' => 'Telegram', | |
'title' => 'Share on Telegram', | |
'alt_title' => 'Share on Telegram', | |
'icon_class' => 'icomoon-the7-font-telegram', | |
'custom_atts' => '', | |
); | |
return $share_buttons; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment