Version Description
- Add background colors to share buttons on AMP (Accelerated Mobile Pages) to support new AddToAny SVG icons
- Fix AMP issue from
in_the_loop
check in 1.7.3 - Remove
in_the_loop
context check because AMP doesn't use the loop - Use packaged AddToAny icon in admin (thanks xaviernieto)
Download this release
Release Info
Developer | micropat |
Plugin | AddToAny Share Buttons |
Version | 1.7.5 |
Comparing to | |
See all releases |
Code changes from version 1.7.4 to 1.7.5
- README.txt +7 -1
- add-to-any.php +14 -7
- addtoany.admin.php +7 -2
README.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: micropat, addtoany
|
|
3 |
Tags: AddToAny, share, sharing, social, share button, share buttons, social media, media, marketing, links, email, seo, woocommerce, ecommerce, google, linkedin, reddit, facebook, like, twitter, pinterest, whatsapp, instagram, youtube, addthis, share this, sharethis, feed, icons
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 4.7
|
6 |
-
Stable tag: 1.7.
|
7 |
|
8 |
Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
|
9 |
|
@@ -334,6 +334,12 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
|
|
334 |
|
335 |
== Changelog ==
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
= 1.7.4 =
|
338 |
* Fix custom/secondary contexts check when the WP query object is unavailable
|
339 |
|
3 |
Tags: AddToAny, share, sharing, social, share button, share buttons, social media, media, marketing, links, email, seo, woocommerce, ecommerce, google, linkedin, reddit, facebook, like, twitter, pinterest, whatsapp, instagram, youtube, addthis, share this, sharethis, feed, icons
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 4.7
|
6 |
+
Stable tag: 1.7.5
|
7 |
|
8 |
Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
|
9 |
|
334 |
|
335 |
== Changelog ==
|
336 |
|
337 |
+
= 1.7.5 =
|
338 |
+
* Add background colors to share buttons on [AMP](https://wordpress.org/plugins/amp/) (Accelerated Mobile Pages) to support new AddToAny SVG icons
|
339 |
+
* Fix AMP issue from `in_the_loop` check in 1.7.3
|
340 |
+
* Remove `in_the_loop` context check because AMP doesn't use the loop
|
341 |
+
* Use packaged AddToAny icon in admin (thanks xaviernieto)
|
342 |
+
|
343 |
= 1.7.4 =
|
344 |
* Fix custom/secondary contexts check when the WP query object is unavailable
|
345 |
|
add-to-any.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.7.
|
7 |
Author: AddToAny
|
8 |
Author URI: https://www.addtoany.com/
|
9 |
Text Domain: add-to-any
|
@@ -211,6 +211,7 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
211 |
|
212 |
$https_or_http = is_ssl() ? 'https' : 'http';
|
213 |
$is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
|
|
|
214 |
|
215 |
// Large icons except for AMP endpoint
|
216 |
$large_icons = $is_amp ? false : true;
|
@@ -320,6 +321,8 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
320 |
$height_attr = isset( $service['icon_height'] ) ? ' height="' . $service['icon_height'] . '"' : ' height="16"';
|
321 |
$height_attr = $is_amp && ! empty( $icon_size ) ? ' height="' . $icon_size . '"' : $height_attr;
|
322 |
|
|
|
|
|
323 |
$url = ( isset( $href ) ) ? $href : $https_or_http . '://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $linkurl_enc .'&linkname=' . $linkname_enc;
|
324 |
$src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
|
325 |
$counter = ( $counter_enabled ) ? ' a2a_counter' : '';
|
@@ -348,6 +351,10 @@ function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
|
|
348 |
|
349 |
$ind_html .= $html_container_close;
|
350 |
|
|
|
|
|
|
|
|
|
351 |
if ( true == $output_later )
|
352 |
return $ind_html;
|
353 |
else
|
@@ -394,6 +401,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
|
|
394 |
|
395 |
$is_feed = is_feed();
|
396 |
$is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
|
|
|
397 |
$button_class = '';
|
398 |
$button_data_media = $is_kit || empty( $linkmedia ) ? '' : ' data-a2a-media="' . $linkmedia . '"';
|
399 |
$button_data_title = $is_kit || empty( $linkname ) ? '' : ' data-a2a-title="' . $linkname . '"';
|
@@ -413,6 +421,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
|
|
413 |
$button_src = 'https://static.addtoany.com/buttons/a2a.svg';
|
414 |
$button_width = ! empty( $icon_size ) ? ' width="' . $icon_size .'"' : ' width="32"';
|
415 |
$button_height = ! empty( $icon_size ) ? ' height="' . $icon_size .'"' : ' height="32"';
|
|
|
416 |
} else {
|
417 |
// Skip button IMG for A2A icon insertion
|
418 |
$button_text = '';
|
@@ -474,6 +483,10 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
|
|
474 |
// Closing tags come after <script> to validate in case the container is a list element
|
475 |
$button_html .= $html_wrap_close . $html_container_close;
|
476 |
|
|
|
|
|
|
|
|
|
477 |
if ( isset( $output_later ) && $output_later == true )
|
478 |
return $button_html;
|
479 |
else
|
@@ -767,12 +780,6 @@ add_action( 'wp_footer', 'A2A_SHARE_SAVE_footer_script' );
|
|
767 |
function A2A_SHARE_SAVE_add_to_content( $content ) {
|
768 |
global $wp_current_filter;
|
769 |
|
770 |
-
// Bail if not in the loop
|
771 |
-
if ( ! in_the_loop() ) {
|
772 |
-
// Return early
|
773 |
-
return $content;
|
774 |
-
}
|
775 |
-
|
776 |
// Don't add to get_the_excerpt because it's too early and strips tags (adding to the_excerpt is allowed)
|
777 |
if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
|
778 |
// Return early
|
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.7.5
|
7 |
Author: AddToAny
|
8 |
Author URI: https://www.addtoany.com/
|
9 |
Text Domain: add-to-any
|
211 |
|
212 |
$https_or_http = is_ssl() ? 'https' : 'http';
|
213 |
$is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
|
214 |
+
$amp_css = '';
|
215 |
|
216 |
// Large icons except for AMP endpoint
|
217 |
$large_icons = $is_amp ? false : true;
|
321 |
$height_attr = isset( $service['icon_height'] ) ? ' height="' . $service['icon_height'] . '"' : ' height="16"';
|
322 |
$height_attr = $is_amp && ! empty( $icon_size ) ? ' height="' . $icon_size . '"' : $height_attr;
|
323 |
|
324 |
+
$amp_css .= $is_amp && ! empty( $service['color'] ) ? '.a2a_button_' . $safe_name . ' img{background-color:#' . $service['color'] . ';}' : '';
|
325 |
+
|
326 |
$url = ( isset( $href ) ) ? $href : $https_or_http . '://www.addtoany.com/add_to/' . $safe_name . '?linkurl=' . $linkurl_enc .'&linkname=' . $linkname_enc;
|
327 |
$src = ( $icon_url ) ? $icon_url : $icons_dir . $icon . '.' . $icons_type;
|
328 |
$counter = ( $counter_enabled ) ? ' a2a_counter' : '';
|
351 |
|
352 |
$ind_html .= $html_container_close;
|
353 |
|
354 |
+
if ( $is_amp ) {
|
355 |
+
add_action( 'amp_post_template_css', function( $amp_template ) use ( $amp_css ) { echo $amp_css; } );
|
356 |
+
}
|
357 |
+
|
358 |
if ( true == $output_later )
|
359 |
return $ind_html;
|
360 |
else
|
401 |
|
402 |
$is_feed = is_feed();
|
403 |
$is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ? true : false;
|
404 |
+
$amp_css = '';
|
405 |
$button_class = '';
|
406 |
$button_data_media = $is_kit || empty( $linkmedia ) ? '' : ' data-a2a-media="' . $linkmedia . '"';
|
407 |
$button_data_title = $is_kit || empty( $linkname ) ? '' : ' data-a2a-title="' . $linkname . '"';
|
421 |
$button_src = 'https://static.addtoany.com/buttons/a2a.svg';
|
422 |
$button_width = ! empty( $icon_size ) ? ' width="' . $icon_size .'"' : ' width="32"';
|
423 |
$button_height = ! empty( $icon_size ) ? ' height="' . $icon_size .'"' : ' height="32"';
|
424 |
+
$amp_css = '.a2a_dd img{background-color:#0166FF;}';
|
425 |
} else {
|
426 |
// Skip button IMG for A2A icon insertion
|
427 |
$button_text = '';
|
483 |
// Closing tags come after <script> to validate in case the container is a list element
|
484 |
$button_html .= $html_wrap_close . $html_container_close;
|
485 |
|
486 |
+
if ( $is_amp ) {
|
487 |
+
add_action( 'amp_post_template_css', function( $amp_template ) use ( $amp_css ) { echo $amp_css; } );
|
488 |
+
}
|
489 |
+
|
490 |
if ( isset( $output_later ) && $output_later == true )
|
491 |
return $button_html;
|
492 |
else
|
780 |
function A2A_SHARE_SAVE_add_to_content( $content ) {
|
781 |
global $wp_current_filter;
|
782 |
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
// Don't add to get_the_excerpt because it's too early and strips tags (adding to the_excerpt is allowed)
|
784 |
if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
|
785 |
// Return early
|
addtoany.admin.php
CHANGED
@@ -507,7 +507,7 @@ function A2A_SHARE_SAVE_options_page() {
|
|
507 |
<div class="addtoany_icon_size_large">
|
508 |
<label class="addtoany_override a2a_kit_size_32">
|
509 |
<input name="A2A_SHARE_SAVE_button" value="A2A_SVG_32" type="radio"<?php if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
|
510 |
-
<
|
511 |
</label>
|
512 |
<br>
|
513 |
</div>
|
@@ -1197,13 +1197,18 @@ function A2A_SHARE_SAVE_admin_head() {
|
|
1197 |
}
|
1198 |
}
|
1199 |
|
1200 |
-
.a2a_kit_size_32.addtoany_override .a2a_svg
|
|
|
1201 |
border-radius: 4px;
|
1202 |
display:inline-block;
|
1203 |
height: 32px;
|
1204 |
vertical-align:middle;
|
1205 |
width: 32px;
|
1206 |
}
|
|
|
|
|
|
|
|
|
1207 |
|
1208 |
#A2A_SHARE_SAVE_reset_options{color:red;margin-left: 15px;}
|
1209 |
</style>
|
507 |
<div class="addtoany_icon_size_large">
|
508 |
<label class="addtoany_override a2a_kit_size_32">
|
509 |
<input name="A2A_SHARE_SAVE_button" value="A2A_SVG_32" type="radio"<?php if ( ! isset( $options['button'] ) || 'A2A_SVG_32' == $options['button'] ) echo ' checked="checked"'; ?> style="margin:9px 0;vertical-align:middle">
|
510 |
+
<img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/icons/a2a.svg'; ?>" width="32" height="32" alt="AddToAny" onclick="this.parentNode.firstChild.checked=true" />
|
511 |
</label>
|
512 |
<br>
|
513 |
</div>
|
1197 |
}
|
1198 |
}
|
1199 |
|
1200 |
+
.a2a_kit_size_32.addtoany_override .a2a_svg,
|
1201 |
+
.a2a_kit_size_32.addtoany_override img {
|
1202 |
border-radius: 4px;
|
1203 |
display:inline-block;
|
1204 |
height: 32px;
|
1205 |
vertical-align:middle;
|
1206 |
width: 32px;
|
1207 |
}
|
1208 |
+
.a2a_kit_size_32.addtoany_override img {
|
1209 |
+
background-color: #0166FF;
|
1210 |
+
margin-left: 9px;
|
1211 |
+
}
|
1212 |
|
1213 |
#A2A_SHARE_SAVE_reset_options{color:red;margin-left: 15px;}
|
1214 |
</style>
|