Use code BLACKFRIDAY through Dec. 1st for 30% off!

Filters to further customize Novashare

Below is a list of all the filters available in Novashare. These allow you to further customize the plugin. If you need an easy way to add a filter, we recommend the free Code Snippets plugin.

novashare_mobile_networks

The novashare_mobile_networks filter allows you to change the networks that only show on mobile devices.

The default networks that only show on mobile are:

  • line
  • messenger
  • sms
  • whatsapp

Remove a network

To remove a network from the mobile-only list, you can specify them with the following filter. In this example, we removed sms and messenger.

add_filter('novashare_mobile_networks', function($networks) {
	$networks = array_diff($networks, array('sms', 'messenger'));
	return $networks;	
});

Add a network

To add a network to the mobile-only list, you can specify them with the following filter. In this example, we added twitter, facebook, and pinterest.

//add network(s) to mobile only list
add_filter('novashare_mobile_networks', function($networks) {
	array_push($networks, 'twitter', 'facebook', 'pinterest');
	return $networks;	
});

novashare_ctt_tweet

The novashare_ctt_tweet filter allows you to manipulate the Click to Tweet text immediately before the link is generated.

Below is an example if you wanted to allow shortcodes to be interpreted and pass to Twitter.

add_filter('novashare_ctt_tweet', 'do_shortcode');

novashare_filter_refresh_rates

The novashare_filter_refresh_rates filter allows you to override the Novashare plugin settings with your own share count refresh rates. Below is an example. See more details.

function novashare_custom_refresh_rates($rates) {
	return array(
		'max' => 10800, //3 hours in seconds
		'sets' => array(
			array(
				'modified' => 86400, //1 day in seconds
				'rate' => 3600 //1 hour in seconds
			),
			array(
				'modified' => 604800, //7 days in seconds
				'rate' => 7200 //2 hours in seconds
			)
		)
	);
}
add_filter('novashare_filter_refresh_rates', 'novashare_custom_refresh_rates');

Was this article helpful?

Related Articles