Skip to content

Snippet: How to Add BlueSky Social Share Option

The following snippet can be used to add a BlueSky option to the Total theme social share element.

// Add bluesky share option.
add_filter( 'wpex_social_share_items', function ( $items ) {
	$title = the_title_attribute( [
		'echo' => false,
		'post' => get_post(),
	] );
	$url = get_permalink();
	$items['bluesky'] = [
		'site'     => 'Bluesky',
		'label'    => 'Bluesky',
		'li_class' => 'bluesky',
		'icon'     => 'bluesky',
		'href'     => 'https://bsky.app/intent/compose?text=' . urlencode( $title ) . ': ' . urlencode( esc_url( $url ) ),
	];
	return $items;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top