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

You are here:
Estimated reading time: 1 min

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 ){

	// add WhatsApp
	$social_items[] = 'whatsapp';

	// example removing Twitter
	$to_remove = [

	foreach ($social_items as $key => $value) {
		if( in_array($value, $to_remove, true) ){

	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: 368

Join the conversation