Winter Solstice sale! 30% Off code: SOLSTICE24 Shop Now

ends midnight 12/21 PST

How to add new social share icons

Last Updated: July 9, 2019

NOTE: all the customization code can go in functions.php file in your theme or inside a plugin.

Add the new social share icon to settings to be able to select.

add_filter('evo_single_sharable', 'settings',10,1);

function settings($array){
	$array[] = array('id'=>'eventonsm_sn','type'=>'yesno','name'=>'Social Network');

	return $array;
}

Note the ID we need to use a unique ID that will also be used in below to identify this social share option.

 

Next create the structure of the sharing HTML that need to go in the frontend of the website and connect it with the pluggable filter.

add_filter('evo_se_social_media',  'fe_media',10,1);

function fe_media($array){
	$array['SocialNetwork'] = array(
		'key'=>'eventonsm_sn',
		'counter'=>1,'favicon' => 'linkedin.png',
		'url' => '<a class="li evo_ss" href="http://www.linkedin.com/shareArticle?mini=true&url=PERMALINK&title=TITLE&summary=SUMMARY" target="_blank" title="Share"><i class="fa fa-share"></i></a>',
	);

	return $array;
}

Depending on the social media site you use the URL to share on the site may change. In the above example the sharer URL look like this (for linkedin) http://www.linkedin.com/shareArticle?mini=true&url=PERMALINK&title=TITLE&summary=SUMMARY

Dynamic Parameters in the URL

PERMALINK – this will be replaced with event link

TITLE – this will be replaced with event title

SUMMARY – this will be replaced with an excerpt of the event details.

 

In our above example we are using the fontawesome icons <i class=”fa fa-share”></i> You can use font awesome icons guide to set up custom icons or use your own.

Did this article help you?

Ready to setup your calendar?