Version Description
- New
media
attribute for sharing a specific image or video to the few services that accept arbitrary media (Pinterest, Yummly) - Update
[addtoany]
shortcode to accept specificmedia
URL- Specify a direct media URL in the
media
attribute like[addtoany buttons="pinterest,yummly" media="https://www.example.com/media/picture.jpg"]
to have Pinterest pin that image
- Specify a direct media URL in the
Download this release
Release Info
Developer | micropat |
Plugin | AddToAny Share Buttons |
Version | 1.6.17 |
Comparing to | |
See all releases |
Code changes from version 1.6.16 to 1.6.17
- README.txt +45 -14
- add-to-any.php +33 -19
README.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: micropat, addtoany
|
|
3 |
Tags: AddToAny, sharing, share, social, share button, share buttons, share links, social icons, social media, media, marketing, bookmark, bookmarks, save, post, posts, page, pages, images, image, admin, analytics, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, amp, woocommerce, ecommerce, e-commerce, amazon, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, addthis, sociable, share this, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 4.5
|
6 |
-
Stable tag: 1.6.
|
7 |
|
8 |
Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
|
9 |
|
@@ -119,19 +119,22 @@ Try another web browser, device, and/or Internet connection to see if the button
|
|
119 |
Yes, you can place your sharing buttons exactly where you want them by inserting the following shortcode in a post or page:
|
120 |
`[addtoany]`
|
121 |
|
122 |
-
|
123 |
`[addtoany url="https://www.example.com/page.html" title="Some Example Page"]`
|
124 |
|
125 |
-
|
126 |
`[addtoany buttons="facebook,twitter,google_plus"]`
|
127 |
|
|
|
|
|
|
|
128 |
= For Facebook sharing, how can I set the thumbnail image and description Facebook uses? =
|
129 |
|
130 |
Facebook expects the Title, Description, and Thumbnail of a shared page to be defined in the Open Graph <a href="https://www.addtoany.com/ext/meta-tags/" target="_blank">meta tags</a> of a shared page.
|
131 |
|
132 |
-
Use Facebook's <a href="https://developers.facebook.com/tools/debug/
|
133 |
|
134 |
-
To change the title, description and/or image on Facebook, your theme's header file should be modified according to <a href="https://developers.facebook.com/docs/sharing/opengraph">Facebook's OpenGraph specification</a>. With WordPress, this can be accomplished with plugins such as the <a href="https://wordpress.org/plugins/wordpress-seo/">Yoast SEO</a> or the <a href="https://wordpress.org/plugins/all-in-one-seo-pack/">All in One SEO Pack</a>. Please see those plugins for details, and post in the WordPress or plugin author's forums for more support.
|
135 |
|
136 |
For more technical information on setting your pages up for Facebook sharing, see "Sharing Best Practices for Websites" in <a href="https://developers.facebook.com/docs/sharing/best-practices">Facebook's documentation</a>.
|
137 |
|
@@ -145,22 +148,45 @@ Upload sharing icons in a single directory to a public location, and make sure t
|
|
145 |
|
146 |
= How can I place the share buttons in a specific area of my site? =
|
147 |
|
148 |
-
In the Theme Editor, place this code block where you want the button and individual icons to appear in your theme:
|
149 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>`
|
150 |
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
153 |
-
ADDTOANY_SHARE_SAVE_KIT( array(
|
|
|
|
|
|
|
154 |
} ?>`
|
155 |
|
156 |
-
|
157 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
158 |
ADDTOANY_SHARE_SAVE_KIT( array( 'use_current_page' => true ) );
|
159 |
} ?>`
|
160 |
|
161 |
-
|
162 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
163 |
-
ADDTOANY_SHARE_SAVE_KIT( array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
} ?>`
|
165 |
|
166 |
= How can I add a custom standalone share button? =
|
@@ -172,7 +198,7 @@ You can create a plugin or customize the following example PHP code to add to yo
|
|
172 |
'icon_url' => 'https://www.google.com/favicon.ico',
|
173 |
'icon_width' => 32,
|
174 |
'icon_height' => 32,
|
175 |
-
'href' => 'https://www.example.com/share?url=A2A_LINKURL&title=A2A_LINKNAME'
|
176 |
);
|
177 |
return $services;
|
178 |
}
|
@@ -187,13 +213,13 @@ You can create a plugin or customize the following example PHP code to add to yo
|
|
187 |
'icon_url' => 'https://www.google.com/favicon.ico',
|
188 |
'icon_width' => 32,
|
189 |
'icon_height' => 32,
|
190 |
-
'href' => 'https://www.example.com/ID'
|
191 |
);
|
192 |
return $services;
|
193 |
}
|
194 |
add_filter( 'A2A_FOLLOW_services', 'addtoany_add_follow_services', 10, 1 );`
|
195 |
|
196 |
-
= How can I align the sharing
|
197 |
It depends on your theme, but you can try adding the following CSS code to your Additional CSS box in Settings > AddToAny.
|
198 |
|
199 |
To align right:
|
@@ -300,6 +326,11 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
|
|
300 |
|
301 |
== Changelog ==
|
302 |
|
|
|
|
|
|
|
|
|
|
|
303 |
= 1.6.16 =
|
304 |
* Fix customizer preview check for WordPress versions older than 4.0 (thanks Jessica)
|
305 |
|
3 |
Tags: AddToAny, sharing, share, social, share button, share buttons, share links, social icons, social media, media, marketing, bookmark, bookmarks, save, post, posts, page, pages, images, image, admin, analytics, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, amp, woocommerce, ecommerce, e-commerce, amazon, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, google plus, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, instagram, behance, flickr, foursquare, vimeo, youtube, feed, rss, addthis, sociable, share this, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpml, wpmu, Add to Any
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 4.5
|
6 |
+
Stable tag: 1.6.17
|
7 |
|
8 |
Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
|
9 |
|
119 |
Yes, you can place your sharing buttons exactly where you want them by inserting the following shortcode in a post or page:
|
120 |
`[addtoany]`
|
121 |
|
122 |
+
Customize the shared URL like so:
|
123 |
`[addtoany url="https://www.example.com/page.html" title="Some Example Page"]`
|
124 |
|
125 |
+
Display specific share buttons by specifying comma-separated <a href="https://www.addtoany.com/services/">service codes</a>:
|
126 |
`[addtoany buttons="facebook,twitter,google_plus"]`
|
127 |
|
128 |
+
Share a specific image or video to certain services that accept arbitrary media (Pinterest, Yummly):
|
129 |
+
`[addtoany buttons="pinterest,yummly" media="https://www.example.com/media/picture.jpg"]`
|
130 |
+
|
131 |
= For Facebook sharing, how can I set the thumbnail image and description Facebook uses? =
|
132 |
|
133 |
Facebook expects the Title, Description, and Thumbnail of a shared page to be defined in the Open Graph <a href="https://www.addtoany.com/ext/meta-tags/" target="_blank">meta tags</a> of a shared page.
|
134 |
|
135 |
+
Use Facebook's <a href="https://developers.facebook.com/tools/debug/sharing/" target="_blank">Sharing Debugger</a> on your pages to see how Facebook reads your site. "Scrape Again" to test site changes and clear Facebook's cache of a page, or use the <a href="https://developers.facebook.com/tools/debug/sharing/batch/" target="_blank">Batch Invalidator</a> to purge Facebook's cache of multiple URLs.
|
136 |
|
137 |
+
To change the title, description and/or image on Facebook, your theme's header file should be modified according to <a href="https://developers.facebook.com/docs/sharing/opengraph" target="_blank">Facebook's OpenGraph specification</a>. With WordPress, this can be accomplished with plugins such as the <a href="https://wordpress.org/plugins/wordpress-seo/">Yoast SEO</a> or the <a href="https://wordpress.org/plugins/all-in-one-seo-pack/">All in One SEO Pack</a>. Please see those plugins for details, and post in the WordPress or plugin author's forums for more support.
|
138 |
|
139 |
For more technical information on setting your pages up for Facebook sharing, see "Sharing Best Practices for Websites" in <a href="https://developers.facebook.com/docs/sharing/best-practices">Facebook's documentation</a>.
|
140 |
|
148 |
|
149 |
= How can I place the share buttons in a specific area of my site? =
|
150 |
|
151 |
+
In the Theme Editor (or another code editor), place this code block where you want the button and individual icons to appear in your theme:
|
152 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>`
|
153 |
|
154 |
+
You can specify [AddToAny service code(s)](https://www.addtoany.com/services/) to show specific share buttons, for example:
|
155 |
+
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
156 |
+
ADDTOANY_SHARE_SAVE_KIT( array(
|
157 |
+
'buttons' => array( 'facebook', 'twitter', 'google_plus', 'whatsapp' ),
|
158 |
+
) );
|
159 |
+
} ?>`
|
160 |
+
|
161 |
+
To customize the shared URL and title:
|
162 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
163 |
+
ADDTOANY_SHARE_SAVE_KIT( array(
|
164 |
+
'linkname' => 'Example Page',
|
165 |
+
'linkurl' => 'https://example.com/page.html',
|
166 |
+
) );
|
167 |
} ?>`
|
168 |
|
169 |
+
To share the current URL and title (detected on the client-side):
|
170 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
171 |
ADDTOANY_SHARE_SAVE_KIT( array( 'use_current_page' => true ) );
|
172 |
} ?>`
|
173 |
|
174 |
+
To hardcode the shared current URL and modify the title (server-side):
|
175 |
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
176 |
+
ADDTOANY_SHARE_SAVE_KIT( array(
|
177 |
+
'linkname' => ( is_home() ? get_bloginfo( 'description' ) : wp_title( '', false ) ),
|
178 |
+
'linkurl' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'],
|
179 |
+
) );
|
180 |
+
} ?>`
|
181 |
+
|
182 |
+
To share a specific image or video to certain services that accept arbitrary media (Pinterest, Yummly):
|
183 |
+
`<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) {
|
184 |
+
ADDTOANY_SHARE_SAVE_KIT( array(
|
185 |
+
'buttons' => array( 'pinterest', 'yummly' ),
|
186 |
+
'linkmedia' => 'https://www.example.com/media/picture.jpg',
|
187 |
+
'linkname' => 'Example Page',
|
188 |
+
'linkurl' => 'https://www.example.com/page.html',
|
189 |
+
) );
|
190 |
} ?>`
|
191 |
|
192 |
= How can I add a custom standalone share button? =
|
198 |
'icon_url' => 'https://www.google.com/favicon.ico',
|
199 |
'icon_width' => 32,
|
200 |
'icon_height' => 32,
|
201 |
+
'href' => 'https://www.example.com/share?url=A2A_LINKURL&title=A2A_LINKNAME',
|
202 |
);
|
203 |
return $services;
|
204 |
}
|
213 |
'icon_url' => 'https://www.google.com/favicon.ico',
|
214 |
'icon_width' => 32,
|
215 |
'icon_height' => 32,
|
216 |
+
'href' => 'https://www.example.com/ID',
|
217 |
);
|
218 |
return $services;
|
219 |
}
|
220 |
add_filter( 'A2A_FOLLOW_services', 'addtoany_add_follow_services', 10, 1 );`
|
221 |
|
222 |
+
= How can I align the standard sharing buttons to the center or to the right side of posts? =
|
223 |
It depends on your theme, but you can try adding the following CSS code to your Additional CSS box in Settings > AddToAny.
|
224 |
|
225 |
To align right:
|
326 |
|
327 |
== Changelog ==
|
328 |
|
329 |
+
= 1.6.17 =
|
330 |
+
* New `media` attribute for sharing a specific image or video to the few services that accept arbitrary media (Pinterest, Yummly)
|
331 |
+
* Update `[addtoany]` shortcode to accept specific `media` URL
|
332 |
+
* Specify a direct media URL in the `media` attribute like `[addtoany buttons="pinterest,yummly" media="https://www.example.com/media/picture.jpg"]` to have Pinterest pin that image
|
333 |
+
|
334 |
= 1.6.16 =
|
335 |
* Fix customizer preview check for WordPress versions older than 4.0 (thanks Jessica)
|
336 |
|
add-to-any.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: AddToAny Share Buttons
|
4 |
Plugin URI: https://www.addtoany.com/
|
5 |
-
Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
|
6 |
-
Version: 1.6.
|
7 |
Author: AddToAny
|
8 |
Author URI: https://www.addtoany.com/
|
9 |
Text Domain: add-to-any
|
@@ -42,15 +42,14 @@ function A2A_SHARE_SAVE_init() {
|
|
42 |
}
|
43 |
add_filter( 'init', 'A2A_SHARE_SAVE_init' );
|
44 |
|
45 |
-
function A2A_SHARE_SAVE_link_vars( $linkname = false, $linkurl = false ) {
|
46 |
global $post;
|
47 |
|
48 |
// Set linkname
|
49 |
if ( ! $linkname ) {
|
50 |
if ( isset( $post ) ) {
|
51 |
$linkname = html_entity_decode( strip_tags( get_the_title( $post->ID ) ), ENT_QUOTES, 'UTF-8' );
|
52 |
-
}
|
53 |
-
else {
|
54 |
$linkname = '';
|
55 |
}
|
56 |
}
|
@@ -61,15 +60,17 @@ function A2A_SHARE_SAVE_link_vars( $linkname = false, $linkurl = false ) {
|
|
61 |
if ( ! $linkurl ) {
|
62 |
if ( isset( $post ) ) {
|
63 |
$linkurl = get_permalink( $post->ID );
|
64 |
-
}
|
65 |
-
else {
|
66 |
$linkurl = '';
|
67 |
}
|
68 |
}
|
69 |
|
70 |
$linkurl_enc = rawurlencode( $linkurl );
|
71 |
|
72 |
-
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
// Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON
|
@@ -178,16 +179,19 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
178 |
|
179 |
$options = get_option( 'addtoany_options' );
|
180 |
|
181 |
-
$linkname =
|
182 |
-
$linkurl =
|
|
|
183 |
|
184 |
-
$args = array_merge( $args, A2A_SHARE_SAVE_link_vars( $linkname, $linkurl ) ); // linkname_enc, etc.
|
185 |
|
186 |
$defaults = array(
|
187 |
'linkname' => '',
|
188 |
'linkurl' => '',
|
|
|
189 |
'linkname_enc' => '',
|
190 |
'linkurl_enc' => '',
|
|
|
191 |
'output_later' => false,
|
192 |
'html_container_open' => '',
|
193 |
'html_container_close' => '',
|
@@ -359,17 +363,20 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
|
|
359 |
|
360 |
$options = get_option( 'addtoany_options' );
|
361 |
|
362 |
-
$linkname =
|
363 |
-
$linkurl =
|
|
|
364 |
$_addtoany_targets = ( isset( $_addtoany_targets ) ) ? $_addtoany_targets : array();
|
365 |
|
366 |
-
$args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc.
|
367 |
|
368 |
$defaults = array(
|
369 |
'linkname' => '',
|
370 |
'linkurl' => '',
|
|
|
371 |
'linkname_enc' => '',
|
372 |
'linkurl_enc' => '',
|
|
|
373 |
'use_current_page' => false,
|
374 |
'output_later' => false,
|
375 |
'is_kit' => false,
|
@@ -483,8 +490,10 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
|
|
483 |
} else {
|
484 |
// wp_json_encode available since 4.1
|
485 |
$linkname_sanitized = function_exists( 'wp_json_encode' ) ? wp_json_encode ( $linkname ) : json_encode( $linkname );
|
|
|
486 |
$button_config = "\n{title:". $linkname_sanitized . ','
|
487 |
-
. 'url:"' . $linkurl . '"
|
|
|
488 |
$_addtoany_targets[] = $button_config;
|
489 |
}
|
490 |
|
@@ -541,10 +550,11 @@ function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
|
|
541 |
|
542 |
$options = get_option( 'addtoany_options' );
|
543 |
|
544 |
-
$linkname = ( isset( $args['linkname'] ) ) ? $args['linkname'] :
|
545 |
-
$linkurl = ( isset( $args['linkurl'] ) ) ? $args['linkurl'] :
|
|
|
546 |
|
547 |
-
$args = array_merge( $args, A2A_SHARE_SAVE_link_vars( $linkname, $linkurl ) ); // linkname_enc, etc.
|
548 |
extract( $args );
|
549 |
|
550 |
$special_anchor_template = '<a class="a2a_button_%1$s addtoany_special_service"%2$s></a>';
|
@@ -577,6 +587,7 @@ function ADDTOANY_SHARE_SAVE_SPECIAL( $special_service_code, $args = array() ) {
|
|
577 |
elseif ( $special_service_code == 'pinterest_pin' ) {
|
578 |
$custom_attributes .= ( $options['special_pinterest_pin_options']['show_count'] == '1' ) ? '' : ' data-pin-config="none"';
|
579 |
$custom_attributes .= ' data-url="' . $linkurl . '"';
|
|
|
580 |
$special_html = sprintf( $special_anchor_template, $special_service_code, $custom_attributes );
|
581 |
}
|
582 |
|
@@ -798,6 +809,7 @@ function A2A_SHARE_SAVE_head_script() {
|
|
798 |
. "target=targets[i];"
|
799 |
. "a2a_config.linkname=target.title;"
|
800 |
. "a2a_config.linkurl=target.url;"
|
|
|
801 |
. "if(el){"
|
802 |
. "a2a.init('page',{target:el});"
|
803 |
. "el.id='';" // Remove ID so AJAX can reuse the same ID
|
@@ -961,17 +973,19 @@ function A2A_SHARE_SAVE_shortcode( $attributes ) {
|
|
961 |
extract( shortcode_atts( array(
|
962 |
'url' => 'something',
|
963 |
'title' => 'something else',
|
|
|
964 |
'buttons' => '',
|
965 |
), $attributes ) );
|
966 |
|
967 |
$linkname = isset( $attributes['title'] ) ? $attributes['title'] : false;
|
968 |
$linkurl = isset( $attributes['url'] ) ? $attributes['url'] : false;
|
|
|
969 |
$buttons = ! empty( $buttons ) ? explode ( ',', $buttons ) : array();
|
970 |
|
971 |
$output_later = true;
|
972 |
|
973 |
return '<div class="addtoany_shortcode">'
|
974 |
-
. ADDTOANY_SHARE_SAVE_KIT( compact( 'linkname', 'linkurl', 'output_later', 'buttons' ) )
|
975 |
. '</div>';
|
976 |
}
|
977 |
|
2 |
/*
|
3 |
Plugin Name: AddToAny Share Buttons
|
4 |
Plugin URI: https://www.addtoany.com/
|
5 |
+
Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
|
6 |
+
Version: 1.6.17
|
7 |
Author: AddToAny
|
8 |
Author URI: https://www.addtoany.com/
|
9 |
Text Domain: add-to-any
|
42 |
}
|
43 |
add_filter( 'init', 'A2A_SHARE_SAVE_init' );
|
44 |
|
45 |
+
function A2A_SHARE_SAVE_link_vars( $linkname = false, $linkurl = false, $linkmedia = false ) {
|
46 |
global $post;
|
47 |
|
48 |
// Set linkname
|
49 |
if ( ! $linkname ) {
|
50 |
if ( isset( $post ) ) {
|
51 |
$linkname = html_entity_decode( strip_tags( get_the_title( $post->ID ) ), ENT_QUOTES, 'UTF-8' );
|
52 |
+
} else {
|
|
|
53 |
$linkname = '';
|
54 |
}
|
55 |
}
|
60 |
if ( ! $linkurl ) {
|
61 |
if ( isset( $post ) ) {
|
62 |
$linkurl = get_permalink( $post->ID );
|
63 |
+
} else {
|
|
|
64 |
$linkurl = '';
|
65 |
}
|
66 |
}
|
67 |
|
68 |
$linkurl_enc = rawurlencode( $linkurl );
|
69 |
|
70 |
+
// Set linkmedia (only applies to services that explicitly accept media; Pinterest does, most do not)
|
71 |
+
$linkmedia_enc = ! empty( $linkmedia ) ? rawurlencode( $linkmedia ) : false;
|
72 |
+
|
73 |
+
return compact( 'linkname', 'linkname_enc', 'linkurl', 'linkurl_enc', 'linkmedia', 'linkmedia_enc' );
|
74 |
}
|
75 |
|
76 |
// Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON
|
179 |
|
180 |
$options = get_option( 'addtoany_options' );
|
181 |
|
182 |
+
$linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
|
183 |
+
$linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
|
184 |
+
$linkmedia = isset( $args['linkmedia'] ) ? $args['linkmedia'] : false;
|
185 |
|
186 |
+
$args = array_merge( $args, A2A_SHARE_SAVE_link_vars( $linkname, $linkurl, $linkmedia ) ); // linkname_enc, etc.
|
187 |
|
188 |
$defaults = array(
|
189 |
'linkname' => '',
|
190 |
'linkurl' => '',
|
191 |
+
'linkmedia' => '',
|
192 |
'linkname_enc' => '',
|
193 |
'linkurl_enc' => '',
|
194 |
+
'linkmedia_enc' => '',
|
195 |
'output_later' => false,
|
196 |
'html_container_open' => '',
|
197 |
'html_container_close' => '',
|
363 |
|
364 |
$options = get_option( 'addtoany_options' );
|
365 |
|
366 |
+
$linkname = isset( $args['linkname'] ) ? $args['linkname'] : false;
|
367 |
+
$linkurl = isset( $args['linkurl'] ) ? $args['linkurl'] : false;
|
368 |
+
$linkmedia = isset( $args['linkmedia'] ) ? $args['linkmedia'] : false;
|
369 |
$_addtoany_targets = ( isset( $_addtoany_targets ) ) ? $_addtoany_targets : array();
|
370 |
|
371 |
+
$args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl, $linkmedia)); // linkname_enc, etc.
|
372 |
|
373 |
$defaults = array(
|
374 |
'linkname' => '',
|
375 |
'linkurl' => '',
|
376 |
+
'linkmedia' => '',
|
377 |
'linkname_enc' => '',
|
378 |
'linkurl_enc' => '',
|
379 |
+
'linkmedia_enc' => '',
|
380 |
'use_current_page' => false,
|
381 |
'output_later' => false,
|
382 |
'is_kit' => false,
|
490 |
} else {
|
491 |
// wp_json_encode available since 4.1
|
492 |
$linkname_sanitized = function_exists( 'wp_json_encode' ) ? wp_json_encode ( $linkname ) : json_encode( $linkname );
|
493 |
+
$linkmedia_optional = ! empty( $linkmedia ) ? ',media:"' . $linkmedia . '"' : '' ;
|
494 |
$button_config = "\n{title:". $linkname_sanitized . ','
|
495 |
+
. 'url:"' . $linkurl . '"'
|
496 |
+
. $linkmedia_optional . '}';
|
497 |
$_addtoany_targets[] = $button_config;
|
498 |
}
|
499 |
|
550 |
|
551 |
$options = get_option( 'addtoany_options' );
|
552 |
|
553 |
+
$linkname = ( isset( $args['linkname'] ) ) ? $args['linkname'] : false;
|
554 |
+
$linkurl = ( isset( $args['linkurl'] ) ) ? $args['linkurl'] : false;
|
555 |
+
$linkmedia = ( isset( $args['linkmedia'] ) ) ? $args['linkmedia'] : false;
|
556 |
|
557 |
+
$args = array_merge( $args, A2A_SHARE_SAVE_link_vars( $linkname, $linkurl, $linkmedia ) ); // linkname_enc, etc.
|
558 |
extract( $args );
|
559 |
|
560 |
$special_anchor_template = '<a class="a2a_button_%1$s addtoany_special_service"%2$s></a>';
|
587 |
elseif ( $special_service_code == 'pinterest_pin' ) {
|
588 |
$custom_attributes .= ( $options['special_pinterest_pin_options']['show_count'] == '1' ) ? '' : ' data-pin-config="none"';
|
589 |
$custom_attributes .= ' data-url="' . $linkurl . '"';
|
590 |
+
$custom_attributes .= ( ! empty( $linkmedia ) ) ? ' data-media="' . $linkmedia . '"' : '';
|
591 |
$special_html = sprintf( $special_anchor_template, $special_service_code, $custom_attributes );
|
592 |
}
|
593 |
|
809 |
. "target=targets[i];"
|
810 |
. "a2a_config.linkname=target.title;"
|
811 |
. "a2a_config.linkurl=target.url;"
|
812 |
+
. "a2a_config.linkmedia=target.media;"
|
813 |
. "if(el){"
|
814 |
. "a2a.init('page',{target:el});"
|
815 |
. "el.id='';" // Remove ID so AJAX can reuse the same ID
|
973 |
extract( shortcode_atts( array(
|
974 |
'url' => 'something',
|
975 |
'title' => 'something else',
|
976 |
+
'media' => '',
|
977 |
'buttons' => '',
|
978 |
), $attributes ) );
|
979 |
|
980 |
$linkname = isset( $attributes['title'] ) ? $attributes['title'] : false;
|
981 |
$linkurl = isset( $attributes['url'] ) ? $attributes['url'] : false;
|
982 |
+
$linkmedia = ! empty( $attributes['media'] ) ? $attributes['media'] : false;
|
983 |
$buttons = ! empty( $buttons ) ? explode ( ',', $buttons ) : array();
|
984 |
|
985 |
$output_later = true;
|
986 |
|
987 |
return '<div class="addtoany_shortcode">'
|
988 |
+
. ADDTOANY_SHARE_SAVE_KIT( compact( 'linkname', 'linkurl', 'linkmedia', 'output_later', 'buttons' ) )
|
989 |
. '</div>';
|
990 |
}
|
991 |
|