Skip to content

Instantly share code, notes, and snippets.

@thecodepoetry
Created April 9, 2021 13:50
Show Gist options
  • Save thecodepoetry/a5c16fe77b833f3bcb5c794ce0946f8b to your computer and use it in GitHub Desktop.
Save thecodepoetry/a5c16fe77b833f3bcb5c794ce0946f8b to your computer and use it in GitHub Desktop.
telgram share button
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