AddToAny Share Buttons - Version 1.7.39

Version Description

  • Fix AMP version of the AddToAny universal icon
  • Enable the addtoany_content_priority filter hook to modify the priority of standard placement in content
  • Add a workaround for a bug in Jetpack's Related Posts on AMP pages that prevents some added content from loading
  • Bump minimum PHP version to 5.6
Download this release

Release Info

Developer micropat
Plugin Icon 128x128 AddToAny Share Buttons
Version 1.7.39
Comparing to
See all releases

Code changes from version 1.7.38 to 1.7.39

Files changed (3) hide show
  1. README.txt +9 -3
  2. add-to-any.php +10 -4
  3. addtoany.compat.php +17 -0
README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: micropat, addtoany
3
  Tags: buttons, share, icons, social media, share buttons, sharing, share button, media, social, marketing, links, email, seo, woocommerce, google, linkedin, reddit, facebook, twitter, pinterest, whatsapp, instagram, youtube, share this, sharethis, feed
4
  Requires at least: 3.7
5
  Tested up to: 5.3
6
- Requires PHP: 5.2
7
- Stable tag: 1.7.38
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, WhatsApp, Pinterest, Reddit, many more, and follow icons too.
10
 
@@ -19,7 +19,7 @@ AddToAny is the home of universal sharing, and the AddToAny plugin is the most p
19
  * [**Standard**](https://www.addtoany.com/buttons/customize/wordpress/standalone_services) share buttons — share each piece of content
20
  * [**Floating**](https://www.addtoany.com/buttons/customize/wordpress/floating_share_buttons) share buttons — responsive & customizable, vertical & horizontal
21
  * **Counters** — fast & official [share counts](https://www.addtoany.com/buttons/customize/wordpress/share_counters) in the same style
22
- * **Follow** buttons** — [social media links](https://www.addtoany.com/buttons/customize/wordpress/follow_buttons) to your Instagram, YouTube, Snapchat
23
  * **Image** sharing buttons - share buttons for [sharing images](https://www.addtoany.com/buttons/customize/wordpress/image_sharing)
24
  * **Vector** share buttons & follow buttons — [custom color](https://www.addtoany.com/buttons/customize/wordpress/icon_color) SVG icons
25
  * **Custom** share icons — use your own if you prefer
@@ -346,6 +346,12 @@ Upload (or move) the `add-to-any` plugin directory into the `/wp-content/mu-plug
346
 
347
  == Changelog ==
348
 
 
 
 
 
 
 
349
  = 1.7.38 =
350
  * Update AMP support for compatibility with AMP's standard mode
351
 
3
  Tags: buttons, share, icons, social media, share buttons, sharing, share button, media, social, marketing, links, email, seo, woocommerce, google, linkedin, reddit, facebook, twitter, pinterest, whatsapp, instagram, youtube, share this, sharethis, feed
4
  Requires at least: 3.7
5
  Tested up to: 5.3
6
+ Requires PHP: 5.6
7
+ Stable tag: 1.7.39
8
 
9
  Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, WhatsApp, Pinterest, Reddit, many more, and follow icons too.
10
 
19
  * [**Standard**](https://www.addtoany.com/buttons/customize/wordpress/standalone_services) share buttons — share each piece of content
20
  * [**Floating**](https://www.addtoany.com/buttons/customize/wordpress/floating_share_buttons) share buttons — responsive & customizable, vertical & horizontal
21
  * **Counters** — fast & official [share counts](https://www.addtoany.com/buttons/customize/wordpress/share_counters) in the same style
22
+ * **Follow** buttons — [social media links](https://www.addtoany.com/buttons/customize/wordpress/follow_buttons) to your Instagram, YouTube, Snapchat
23
  * **Image** sharing buttons - share buttons for [sharing images](https://www.addtoany.com/buttons/customize/wordpress/image_sharing)
24
  * **Vector** share buttons & follow buttons — [custom color](https://www.addtoany.com/buttons/customize/wordpress/icon_color) SVG icons
25
  * **Custom** share icons — use your own if you prefer
346
 
347
  == Changelog ==
348
 
349
+ = 1.7.39 =
350
+ * Fix AMP version of the AddToAny universal icon
351
+ * Enable the `addtoany_content_priority` filter hook to modify the priority of standard placement in content
352
+ * Add a workaround for a bug in Jetpack's Related Posts on AMP pages that prevents some added content from loading
353
+ * Bump minimum PHP version to 5.6
354
+
355
  = 1.7.38 =
356
  * Update AMP support for compatibility with AMP's standard mode
357
 
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.38
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
@@ -416,6 +416,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
416
  $button_src = $options['button_custom'];
417
  $button_width = '';
418
  $button_height = '';
 
419
  } else if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) {
420
  // Text-only button
421
  $button_text = stripslashes( $options[ 'button_text'] );
@@ -428,6 +429,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
428
  $button_src = 'https://static.addtoany.com/buttons/a2a.svg';
429
  $button_width = ! empty( $args['icon_size'] ) ? ' width="' . $args['icon_size'] .'"' : ' width="32"';
430
  $button_height = ! empty( $args['icon_size'] ) ? ' height="' . $args['icon_size'] .'"' : ' height="32"';
 
431
  }
432
  }
433
 
@@ -436,7 +438,7 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
436
  } elseif ( ! empty( $button_text ) ) {
437
  $button = $button_text;
438
  } elseif ( ! empty( $button_src ) ) {
439
- $button = '<img src="' . $button_src . '"' . $button_width . $button_height . ' alt="Share">';
440
  } else {
441
  $button = '';
442
  }
@@ -974,8 +976,12 @@ function A2A_SHARE_SAVE_add_to_content( $content ) {
974
 
975
  function A2A_SHARE_SAVE_pre_get_posts( $query ) {
976
  if ( $query->is_main_query() ) {
977
- add_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 98 );
978
- add_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98 );
 
 
 
 
979
  }
980
  }
981
 
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.39
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  Text Domain: add-to-any
416
  $button_src = $options['button_custom'];
417
  $button_width = '';
418
  $button_height = '';
419
+ $button_style = '';
420
  } else if ( isset( $options['button'] ) && 'TEXT' == $options['button'] ) {
421
  // Text-only button
422
  $button_text = stripslashes( $options[ 'button_text'] );
429
  $button_src = 'https://static.addtoany.com/buttons/a2a.svg';
430
  $button_width = ! empty( $args['icon_size'] ) ? ' width="' . $args['icon_size'] .'"' : ' width="32"';
431
  $button_height = ! empty( $args['icon_size'] ) ? ' height="' . $args['icon_size'] .'"' : ' height="32"';
432
+ $button_style = $is_amp ? ' style="background-color:#0166ff"' : '';
433
  }
434
  }
435
 
438
  } elseif ( ! empty( $button_text ) ) {
439
  $button = $button_text;
440
  } elseif ( ! empty( $button_src ) ) {
441
+ $button = '<img src="' . $button_src . '"' . $button_width . $button_height . $button_style . ' alt="Share">';
442
  } else {
443
  $button = '';
444
  }
976
 
977
  function A2A_SHARE_SAVE_pre_get_posts( $query ) {
978
  if ( $query->is_main_query() ) {
979
+ // Hook to change the standard buttons' priority number in content
980
+ // Example: add_filter( 'addtoany_content_priority', 20 );
981
+ $priority = apply_filters( 'addtoany_content_priority', 98 );
982
+
983
+ add_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', $priority );
984
+ add_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', $priority );
985
  }
986
  }
987
 
addtoany.compat.php CHANGED
@@ -25,6 +25,7 @@ function addtoany_excerpt_remove() {
25
  /**
26
  * Load AMP (Accelerated Mobile Pages) compatibility functions
27
  */
 
28
  add_action( 'amp_post_template_css', 'addtoany_amp_additional_css_styles' );
29
 
30
  function addtoany_amp_additional_css_styles( $amp_template ) {
@@ -39,6 +40,22 @@ function addtoany_amp_additional_css_styles( $amp_template ) {
39
  <?php
40
  }
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  /**
43
  * Move buttons from WooCommerce product description to WooCommerce's sharing block
44
  */
25
  /**
26
  * Load AMP (Accelerated Mobile Pages) compatibility functions
27
  */
28
+
29
  add_action( 'amp_post_template_css', 'addtoany_amp_additional_css_styles' );
30
 
31
  function addtoany_amp_additional_css_styles( $amp_template ) {
40
  <?php
41
  }
42
 
43
+ /**
44
+ * Change the priority of standard buttons in content to work around a
45
+ * Jetpack ~v7.8 Related Posts bug that removes content added to AMP posts
46
+ * if the content's filter has a priority number greater than 40.
47
+ */
48
+ add_action( 'wp_loaded', 'addtoany_priority_for_amp_jetpack' );
49
+
50
+ function addtoany_priority_for_amp_jetpack() {
51
+ // If the AMP plugin is enabled, the Jetpack plugin is enabled,
52
+ // and Jetpack's Related Posts module is enabled
53
+ if ( class_exists( 'AMP_Autoloader' ) && class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'related-posts' ) ) {
54
+ // Change priority to 20
55
+ add_filter( 'addtoany_content_priority', function() { return 20; } );
56
+ }
57
+ }
58
+
59
  /**
60
  * Move buttons from WooCommerce product description to WooCommerce's sharing block
61
  */