Juiz SPS - Documentation v. 1.3.4

Geoffrey Crofte Developed, designed and polished by Geoffrey Crofte.
French blogger for Creative Juiz blog and Alsacréations community, I'm a code and pixels love! Find me on : Twitter, TryToTry Laboratory or geoffrey.crofte.fr

This file is a documention for the plugin Juiz Social Post Sharer.
It will be updated each time with the plugin features.

Please, note that this documentation concerne all versions of the plugin. Read the "since" mention on each feature.

You like this plugin and want to support it?
Donate Tweet it

See also

Table of content

CSS Classes

If you need to use custom styles for your buttons/links or its container:

/* The big container */
.juiz_sps_links { }

/* Dynamic classes depending on position */
.juiz_sps_displayed_bottom { }
.juiz_sps_displayed_both { }
.juiz_sps_displayed_top { }

/* The <p> hidden to introduce list of links */
.juiz_sps_maybe_hidden_text { }

/* The list of buttons/links */
.juiz_sps_links_list { }

/* An item of this list (<li> element by default) */
.juiz_sps_item { }

/* Each item as a second class depending on social network name */
.juiz_sps_link_facebook { }
.juiz_sps_link_twitter { }
.juiz_sps_link_google { }
.juiz_sps_link_pinterest { }
.juiz_sps_link_linkedin { }
.juiz_sps_link_viadeo { }
.juiz_sps_link_digg { }
.juiz_sps_link_stumbleupon { }
.juiz_sps_link_mail { }
.juiz_sps_link_weibo { }

/* Each item has its icon */
.juiz_sps_icon { }

/* and its name */
.juiz_sps_network_name { }

/* Counters */
/* for each item */
.juiz_sps_counter { }
.juiz_sps_totalcount_item { }
/* the total count bubble */
.juiz_sps_totalcount { } 

You can improve your CSS editions by using Firebug plugin.

ShortCodes since 1.2.0

This plugin has a Shortcode, a kind of BBcode, that allows you to display those buttons where you want.
This shortcode uses the keyword juiz_social or juiz_sps (since 1.2.1), two particular words to oust any conflict with other plugins.

[juiz_social]

Used in a post, this shortcode all the buttons available (all social networks).
Morever, buttons are selectable with there slug in a shortcode parameter:

Example of use:

[juiz_social buttons="twitter,facebook,google"]

This sample of code show 3 buttons : Twitter, Facebook and Google+ social networks.

Template functions since 1.2.0

Template functions allow you to display list of buttons inside any theme template you need.
There are two functions: juiz_sps($networks, $show_counters, $share_current_page, $is_shortcode, $url_to_share) and get_juiz_sps($networks, $show_counters, $share_current_page, $is_shortcode, $url_to_share)

Parameters

Example of use:

<?php
	/* your social networks */
	$jsps_networks = array( 'twitter', 'facebook', 'google', 'mail' );
	/* show counters */
	$show_counters = 1;

	/* display buttons */
	juiz_sps( $jsps_networks, $show_counters );
?>

juiz_sps() makes an echo, if you need to save data in a variable, use get_juiz_sps().

Example of use:

<?php
	/* your social networks */
	$jsps_networks = array( 'twitter', 'facebook', 'google', 'mail' );

	/* set variable */
	$my_buttons = get_juiz_sps($jsps_networks, 1); // 1 to show counters

	/* more later, display buttons */
	echo $my_buttons;
?>

Hooks since 1.1.0

This plugin allows you to change some parts of its structure without broke the core.
The following samples of code can be inserted in the functions.php file.

Hook: juiz_sps_before_the_sps

Add a content just before the container of this plugin (a div)

<?php
if( !function_exists('before_the_jsps_plugin')) {
	function before_the_jsps_plugin() {
		return '<div class="another_container">';
	}
}
add_filter('juiz_sps_before_the_sps', 'before_the_jsps_plugin');
?>

Hook: juiz_sps_after_the_sps

Add a content just after the container of this plugin (a div).

<?php
if( !function_exists('after_the_jsps_plugin')) {
	function after_the_jsps_plugin() {
		return '<small>
				plugin by 
				<a href="http://creativejuiz.fr">CreativeJuiz</a>
			</small>';
	}
}
add_filter('juiz_sps_after_the_sps', 'after_the_jsps_plugin');
?>

Hook: juiz_sps_container_tag

Change the big container tag of the list (<div>) by another, for example:

<?php
	if( !function_exists('replacing_by_span')) {
		function replacing_by_span() {
			return 'span';
		}
	}
	add_filter('juiz_sps_container_tag', 'replacing_by_span');
	?>

Hook: juiz_sps_list_container_tag

Change the tag of the list container (<ul>) by another, for example:

<?php
if( !function_exists('replacing_by_div')) {
	function replacing_by_div() {
		return 'div';
	}
}
add_filter('juiz_sps_list_container_tag', 'replacing_by_div');
?>

Hook: juiz_sps_phrase_tag

Change the intro phrase tag (hidden with default style) (<p>) by another, for example:

<?php
	if( !function_exists('replacing_by_span')) {
		function replacing_by_span() {
			return 'span';
		}
	}
	add_filter('juiz_sps_phrase_tag', 'replacing_by_span');
	?>

If you want to remove this sentence, see the juiz_sps_hide_intro_phrase hook

Hook: juiz_sps_intro_phrase_text (since v1.3.0)

Change the intro phrase content (the text) by what you want, for example:

<?php
	if( !function_exists('replacing_intro_phrase_text')) {
		function replacing_intro_phrase_text() {
			return __('Share my awesome content');
		}
	}
	add_filter('juiz_sps_intro_phrase_text', 'replacing_intro_phrase_text');
	?>

If you want to remove this sentence, see the juiz_sps_hide_intro_phrase hook

Hook: juiz_sps_container_classes

Adds your own classes to the container element:

<?php
if( !function_exists('juiz_sps_container_classes')) {
	function juiz_sps_container_classes() {
		return 'class1 class2';
	}
}
add_filter('juiz_sps_container_classes', 'add_container_classes');
?>

Hook: juiz_sps_list_of_item_tag

Change the tag of an item of the list (<li>) by another, for example:

<?php
if( !function_exists('replacing_by_div')) {
	function replacing_by_div() {
		return 'div';
	}
}
add_filter('juiz_sps_list_of_item_tag', 'replacing_by_div');
?>

Hook: juiz_sps_before_the_list

Adds content just before de list of buttons (before the <ul> element):

<?php
if( !function_exists('content_before_jsps_list')) {
	function content_before_jsps_list() {
		return '<p class="info">(open in a new window)</p>';
	}
}
add_filter('juiz_sps_before_the_list', 'content_before_jsps_list');
?>

Hook: juiz_sps_after_the_list

Adds content just after de list of buttons (after the <ul> element):

<?php
if( !function_exists('content_after_jsps_list')) {
	function content_after_jsps_list() {
		return '<p class="info">Thank you for sharing!</p>';
	}
}
add_filter('juiz_sps_after_the_list', 'content_after_jsps_list');
?>

Hook: juiz_sps_before_first_item

Adds content just before the first item of the list (before the first <li>):

<?php
if( !function_exists('content_before_jsps_first_item')) {
	function content_before_jsps_first_item() {
		return '<li class="juiz_sps_link_myown"><a href="#">MyOwn link</a></li>';
	}
}
add_filter('juiz_sps_before_first_item', 'content_before_jsps_first_item');
?>

Hook: juiz_sps_after_last_item

Adds content just after the last item of the list (after the last <li>):

<?php
if( !function_exists('content_after_jsps_last_item')) {
	function content_after_jsps_last_item() {
		return '<li class="juiz_sps_link_myown"><a href="#">MyOwn link</a></li>';
	}
}
add_filter('juiz_sps_after_last_item', 'content_after_jsps_last_item');
?>

Hook: juiz_sps_hide_intro_phrase (since v1.3.0)

If you want the remove the introduction sentence of the plugin ("Share the [post-title] article").

<?php
if( !function_exists('hide_the_sps_intro_sentence')) {
	function hide_the_sps_intro_sentence() {
		return true;
	}
}
add_filter('juiz_sps_hide_intro_phrase', 'hide_the_sps_intro_sentence');
?>

Customizes the link shared by users. Be carefull when you customize permalinks, you need a permanent way to find your content ;) (don't create 404 errors)

<?php
if( !function_exists('jsps_custom_permalink')) {
	function jsps_custom_permalink($url) {
		return $url.'?fromJsps';
	}
}
add_filter('juiz_sps_the_shared_permalink', 'jsps_custom_permalink');
?>

Customizes the link shared by users only for the targeted network. Example for Twitter network:

<?php
if( !function_exists('jsps_custom_permalink_for_twitter')) {
	function jsps_custom_permalink($url) {
		return $url.'?doWhatYouWant=twitter';
	}
}
add_filter('juiz_sps_the_shared_permalink_for_twitter', 'jsps_custom_permalink_for_twitter');
?>

Hook: juiz_sps_share_name_for_[network](since v1.3.3.7)

Customizes the name text for each network by replacing [network] by the good social network's name:

<?php
if( !function_exists('jsps_change_twitter_name')) {
function jsps_change_twitter_name(){
	return __('BlueBird');
}
}
add_filter('juiz_sps_share_name_for_twitter', 'jsps_change_twitter_name');
?>

Hook: juiz_sps_share_text_for_[network] (since v1.3.0)

Customizes the text inside each tooltip for each network by replacing [network] by the good social network's name:

<?php
if ( ! function_exists('custom_share_text_for_facebook') ) {
	function custom_share_text_for_facebook() {
		return __('Share my content to your Facebook friends.');
	}
}
add_filter('juiz_sps_share_text_for_facebook', 'custom_share_text_for_facebook');
?>

By default, links are nofollow-links. If you need to remove this attribute:

<?php
if ( ! function_exists('custom_links_attributes') ) {
	function custom_links_attributes() {
		return ''; // you can add new attributes instead... just an idea ;)
	}
}
add_filter('juiz_sps_links_nofollow', 'custom_links_attributes');
?>

Hook: jsps_remove_default_css (since v1.3.3.7)

You need to use your own CSS file, you can remove default CSS files

<?php
if ( ! function_exists('jsps_remove_default_css') ) {
function jsps_remove_default_css(){
	return false;
}
}
add_filter('juiz_sps_use_default_css', 'jsps_remove_default_css');
?>

Hook: juiz_sps_total_count_word (since v1.4.1)

It's a simple filter to remove or change the "Total:" word next to the total counter.

<?php
if ( ! function_exists('jsps_change_title_word') ) {
function jsps_change_title_word(){
	return __('Shares:');
}
}
add_filter('juiz_sps_total_count_word', 'jsps_change_title_word');
?>

Hook: juiz_sps_buttons_in_excerpt (since v1.4.1)

Reject or accept buttons in excerpt

<?php
if ( ! function_exists('jsps_accept_button_in_excerpt') ) {
function jsps_accept_button_in_excerpt(){
	return true;
}
}
add_filter('juiz_sps_buttons_in_excerpt', 'jsps_accept_button_in_excerpt');
?>

FAQ

Twitter counter doesn't appear
Yep, sorry about that, but Twitter decided to shut down counter.
The text shared by default is very ugly, something like "Share the post "YOUR POST TITLE" FacebookTwitterGoogle+E-mail [SOME OTHER WORDS]"?
You certainly activated the buttons in the top of your post. It's your choice, but in this case, you need to improve by yourself the SEO-description of your article/page. You can try using the WordPress SEO plugin by Yoast.
Can I add a "Like" ou "Google +1" button with this plugin?
Yes, but not with the page options of this plugin. You need to use a hook to add an item in your buttons list.
See the juiz_sps_before_first_item or juiz_sps_after_last_item hook in this documentation.
Styles are not loaded, there are some ugly sharing links, why?
This plugin uses the recommandation functions to load plugins styles (recommandation by WordPress). If your theme does not use wp_enqueue_style(), styles of this plugin won't be loaded.
Pinterest button did not find my images, why? (since v1.3.0)
Pinterest API need a "Featured Image" in your post to work. So use the best image of your article as "Featured Image", or turn on the plugin option "Force Pinterest button sniffing all images of the page?". This option needs JavaScript to work, and uses the Pinterest official bookmarklet to scan compatible images with Pinterest service.
I have a fatal error or a 500 server error since update to 1.2.3 (since 1.2.3)
Yes, you surely use Pinterest button. It's a bug, update to 1.2.4 at least.
Thank you.
I can't just use shortcode by deactivating all the checkbox display option in admin option page? (since 1.2.0)
Yes, it's a bug, please, use the plugin version 1.2.2 at least.
Some options are not visible (if it's not the first installation, but an update of the plugin) (since 1.1.0)
Deactivate and reactivate the plugin to force the options rebuild.
Nothing ?
You can open an issue here: http://wordpress.org/support/plugin/juiz-social-post-sharer