How to add more share links in blog posts and product pages

You are here:
Estimated reading time: 1 min

To add more share links in either blog posts or product pages, you will need some coding skills.

Before getting started, you will need to install a child theme.

Open rey-child/functions.php with your favorite code editor and add:

add_filter( 'reycore/post/social_share', function( $social_items, $title, $url ){

	// We'll add Whatsapp in this example
	$social_items['whatsapp'] = sprintf(
		'<a href="whatsapp://send?text=%s" data-action="share/whatsapp/share">%s</a>',
		reycore__get_svg_social_icon( ['id' => 'whatsapp'] )

	// example how to remove a link
	if( isset($social_items['twitter']) ){

	return $social_items;

}, 10, 3);

In the example above, we’re filtering the current list and adding a WhatsApp sharing link and removing Twitter link.

The reycore/post/social_share filter hook passes 3 arguments – the icons list, page title and page url (encoded).

For each sharing link you want to add please remember you need to know the sharing URL of each social platform or app.

Please let me know if you want more icons possibilities to be added (not necessarily enabled by default), but more icons.

These icons are available in the social icons SVG sprite:

Rss, Envelope, 500px, Youtube, Yelp, Xing, WordPress, Whatsapp, Weixin, Weibo, Vk, Vimeo-v, Vimeo, Viber, Twitter, Twitch, Tumblr, Tripadvisor, Telegram, Stumbleupon, Steam, Stack-overflow, Spotify, Soundcloud, Snapchat, Slideshare, Skype, Reddit, Product-hunt, Pinterest-p, Pinterest, Odnoklassniki, Mixcloud, Meetup, Medium, Linkedin, Jsfiddle, Instagram, Houzz, Google-plus, Gitlab, Github, Free-code-camp, Foursquare, Flickr, Facebook, Facebook-f, Dribbble, Digg, Deviantart, Delicious, Codepen, Bitbucket, Android, Apple, Behance .

Was this article helpful?
Dislike 0
Views: 319

Join the conversation