Use code NOVASHARE for an extra 10% 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 force specific networks to only show on mobile devices.

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');

novashare_pinterest_image_minimum_dimension

The novashare_pinterest_image_minimum_dimension filter allows you to change the minimum dimension required (in pixels) for the Pinterest Image hover buttons to be applied to an image. This applies to both width and height. If either dimension falls below the minimum, the image will be excluded.

Below is an example.

add_filter('novashare_pinterest_image_minimum_dimension', function() {
	return 500;
});

novashare_pinterest_image_excluded_attributes

The novashare_pinterest_image_excluded_attributes filter allows you to exclude specific images from getting Pinterest pins applied with an attribute string, such as a class or image file name.

Below is an example.

add_filter('novashare_pinterest_image_excluded_attributes', function($attributes) {

    //add excluded attributes
    $attributes[] = 'class="example-class"';
    $attributes[] = 'example-image.png';

    return $attributes;
});

novashare_pinterest_image_excluded

The novashare_pinterest_image_excluded filter essentially turns the excluded box into a whitelist box instead. This can be used if you want to add Pinterest image pins to a few specific images, instead of across your entire site.

add_filter('novashare_pinterest_image_excluded', function($excluded) {
    return !$excluded;
});

The novashare_network_link filter allows you to modify the final link for a specific network.

Below is an example.

add_filter('novashare_network_link', function($link, $network) {
if($network == 'pinterest') {
//do something with the link here
}
return $link;
}, 10, 2);

novashare_inline_cta

The novashare_inline_cta filter allows you to change the CTA text.

Below is an example on product posts.

add_filter('novashare_inline_cta', function($cta) {
if(is_singular('product')) {
$cta = 'Share this product with your friends!';
}
return $cta;
});

novashare_networks

The novashare_networks filter allows you to change the name of a network.

Below is an example.

add_filter('novashare_networks', function($networks) {
$networks['sms']['name'] = 'Text';
return $networks;
});

Was this article helpful?

Related Articles