AddToAny Share Buttons - Version 1.5.8

Version Description

  • Toggle share buttons on custom post types in AddToAny settings
    • Supports WooCommerce Product post types
    • Supports bbPress Forum, Topic, Reply post types
  • Remove QQ (use Qzone)
  • Remove border from buttons that some themes add to links in posts
Download this release

Release Info

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

Code changes from version 1.5.7 to 1.5.8

Files changed (5) hide show
  1. README.txt +30 -45
  2. add-to-any.php +5 -1
  3. addtoany.admin.php +21 -0
  4. addtoany.min.css +1 -1
  5. addtoany.services.php +0 -9
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: micropat, addtoany
3
  Tags: sharing, share, share this, bookmarking, social, share button, share buttons, share links, social share, social sharing, social bookmarking, social bookmarks, socialize, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, +1, plus 1, google +1, google plus, google plus one, plus one, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpmu, Add to Any, AddToAny
4
  Requires at least: 2.8
5
  Tested up to: 4.3
6
- Stable tag: 1.5.6.1
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
9
 
@@ -162,49 +162,6 @@ If you want to hardcode the shared current URL and modify the title (server-side
162
  ADDTOANY_SHARE_SAVE_KIT( array( 'linkname' => ( is_home() ? get_bloginfo( 'description' ) : wp_title( '', false ) ), 'linkurl' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'] ) );
163
  } ?>`
164
 
165
- = How can I add just the universal button to another area of my theme? =
166
-
167
- In the Theme Editor, you will place this line of code where you want the button to appear in your theme:
168
-
169
- `<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_BUTTON' ) ) { ADDTOANY_SHARE_SAVE_BUTTON(); } ?>`
170
-
171
- If you want to customize the shared URL and title for this button, use the following code as a template:
172
-
173
- `<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_BUTTON' ) ) {
174
- ADDTOANY_SHARE_SAVE_BUTTON( array( 'linkname' => 'Example Page', 'linkurl' => 'http://example.com/page.html' ) );
175
- } ?>`
176
-
177
- = How can I add just the individual icons to another area of my theme? =
178
-
179
- In the Theme Editor, place this line of code where you want the individual icons to appear in your theme (within an HTML list):
180
-
181
- `<?php echo '<div class="a2a_kit a2a_kit_size_32 addtoany_list">';
182
- if ( function_exists( 'ADDTOANY_SHARE_SAVE_ICONS' ) ) { ADDTOANY_SHARE_SAVE_ICONS(); }
183
- echo '</div>'; ?>`
184
-
185
- If you want to customize the shared URL and title for these icons, use the following code as a template:
186
-
187
- `<?php
188
- if ( function_exists( 'ADDTOANY_SHARE_SAVE_ICONS' ) ) {
189
- echo '<div class="a2a_kit a2a_kit_size_32 addtoany_list">';
190
- ADDTOANY_SHARE_SAVE_ICONS( array(
191
- 'linkname' => 'Example Page', 'linkurl' => 'http://example.com/page.html'
192
- ) );
193
- echo '</div>';
194
- } ?>`
195
-
196
- (If you are using the small icons, remove `a2a_kit_size_32` from the line `<div class="a2a_kit a2a_kit_size_32 addtoany_list">` so that you have `<div class="a2a_kit addtoany_list">`.)
197
-
198
- Or you can place the icons as individual links without styling:
199
-
200
- `<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_ICONS' ) ) { ADDTOANY_SHARE_SAVE_ICONS(); } ?>`
201
-
202
- If you want to customize the shared URL and title for these icons, use the following code as a template:
203
-
204
- `<?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_ICONS' ) ) {
205
- ADDTOANY_SHARE_SAVE_ICONS( array( 'linkname' => 'Example Page', 'linkurl' => 'http://example.com/page.html' ) );
206
- } ?>`
207
-
208
  = How can I add a new custom standalone service? =
209
  You can create a plugin or customize the following PHP sample code to add to your theme's function.php file:
210
 
@@ -245,6 +202,27 @@ An older method was to insert the following tag into the page or post (HTML tab)
245
 
246
  Go to `Settings` > `AddToAny` > uncheck `Display at the top or bottom of posts on archive pages`. Archive pages include Category, Tag, Author, Date, and also Search pages.
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  = How can I position a vertical floating share buttons bar relative to content? =
249
 
250
  In settings, disable the default placement of the Vertical Buttons. In your theme's file(s), find the parent element that you want to position the vertical bar to (the parent element should have a specified width), then add the following PHP sample code as a child of that parent element:
@@ -280,7 +258,7 @@ Regardless of circumstances for passing W3C tests, the plugin will always output
280
 
281
  = Why does the menu appear behind embedded objects (like Flash)? =
282
 
283
- Please read <a href="https://www.addtoany.com/buttons/customize/show_over_embeds">this document</a> for an explanation and possible fix. For WordPress, an easier fix is to have the plugin <a href="https://www.addtoany.com/buttons/customize/hide_embeds">hide intersecting embedded objects</a>. Just copy & paste the recommended code into the Additional Options box in `Settings` > `AddToAny`, then save changes.
284
 
285
  = For a WordPress Multisite Network (MS), how can I set the plugin as a "Must-Use" plugin to automatically execute for all blogs? =
286
 
@@ -297,6 +275,13 @@ Upload the plugin directory (including all files and directories within) to the
297
 
298
  == Changelog ==
299
 
 
 
 
 
 
 
 
300
  = 1.5.7 =
301
  * <a href="https://www.addtoany.com/buttons/customize/wordpress/icon_color">Custom color share buttons</a> have arrived!
302
  * Remove Bookmark/Favorites (low browser support)
3
  Tags: sharing, share, share this, bookmarking, social, share button, share buttons, share links, social share, social sharing, social bookmarking, social bookmarks, socialize, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, shortcode, sidebar, widget, responsive, email, e-mail, print, seo, button, delicious, google, tumblr, linkedin, digg, reddit, facebook, facebook share, facebook like, like, twitter, twitter button, twitter share, tweet, tweet button, +1, plus 1, google +1, google plus, google plus one, plus one, pinterest, pin, pin it, pinit, wanelo, buffer, stumbleupon, bitly, whatsapp, lockerz, addthis, sociable, sharedaddy, sharethis, shareaholic, icon, icons, vector, SVG, floating, floating buttons, wpmu, Add to Any, AddToAny
4
  Requires at least: 2.8
5
  Tested up to: 4.3
6
+ Stable tag: 1.5.8
7
 
8
  Share buttons for WordPress including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
9
 
162
  ADDTOANY_SHARE_SAVE_KIT( array( 'linkname' => ( is_home() ? get_bloginfo( 'description' ) : wp_title( '', false ) ), 'linkurl' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'] ) );
163
  } ?>`
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  = How can I add a new custom standalone service? =
166
  You can create a plugin or customize the following PHP sample code to add to your theme's function.php file:
167
 
202
 
203
  Go to `Settings` > `AddToAny` > uncheck `Display at the top or bottom of posts on archive pages`. Archive pages include Category, Tag, Author, Date, and also Search pages.
204
 
205
+ = How can I programmatically remove the button(s)? =
206
+
207
+ In your theme's `functions.php`, you can add a filter to disable AddToAny sharing.
208
+
209
+ Disable AddToAny sharing in specific categories, for example:
210
+ `function addtoany_disable_sharing_in_some_categories() {
211
+ // Examples of in_category usage: https://codex.wordpress.org/Function_Reference/in_category
212
+ if ( in_category( array( 'my_category_1_slug', 'my_category_2_slug' ) ) ) {
213
+ return true;
214
+ }
215
+ }
216
+ add_filter( 'addtoany_sharing_disabled', 'addtoany_disable_sharing_in_some_categories' );`
217
+
218
+ Disable AddToAny sharing on a custom post type, for example:
219
+ `function addtoany_disable_sharing_on_my_custom_post_type() {
220
+ if ( 'my_custom_post_type' == get_post_type() ) {
221
+ return true;
222
+ }
223
+ }
224
+ add_filter( 'addtoany_sharing_disabled', 'addtoany_disable_sharing_on_my_custom_post_type' );`
225
+
226
  = How can I position a vertical floating share buttons bar relative to content? =
227
 
228
  In settings, disable the default placement of the Vertical Buttons. In your theme's file(s), find the parent element that you want to position the vertical bar to (the parent element should have a specified width), then add the following PHP sample code as a child of that parent element:
258
 
259
  = Why does the menu appear behind embedded objects (like Flash)? =
260
 
261
+ Please read <a href="https://www.addtoany.com/buttons/customize/show_over_embeds">this document</a> for an explanation and possible fix. For WordPress, an easier fix is to have the plugin <a href="https://www.addtoany.com/buttons/customize/wordpress/hide_embeds">hide intersecting embedded objects</a>.
262
 
263
  = For a WordPress Multisite Network (MS), how can I set the plugin as a "Must-Use" plugin to automatically execute for all blogs? =
264
 
275
 
276
  == Changelog ==
277
 
278
+ = 1.5.8 =
279
+ * Toggle share buttons on custom post types in AddToAny settings
280
+ * Supports WooCommerce Product post types
281
+ * Supports bbPress Forum, Topic, Reply post types
282
+ * Remove QQ (use Qzone)
283
+ * Remove border from buttons that some themes add to links in posts
284
+
285
  = 1.5.7 =
286
  * <a href="https://www.addtoany.com/buttons/customize/wordpress/icon_color">Custom color share buttons</a> have arrived!
287
  * Remove Bookmark/Favorites (low browser support)
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Share Buttons by AddToAny
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. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
- Version: 1.5.7
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  */
@@ -826,6 +826,7 @@ function A2A_SHARE_SAVE_add_to_content( $content ) {
826
  $options = get_option( 'addtoany_options' );
827
  $sharing_disabled = get_post_meta( get_the_ID(), 'sharing_disabled', true );
828
  $sharing_disabled = apply_filters( 'addtoany_sharing_disabled', $sharing_disabled );
 
829
 
830
  if ( ! $A2A_SHARE_SAVE_auto_placement_ready )
831
  return $content;
@@ -858,6 +859,9 @@ function A2A_SHARE_SAVE_add_to_content( $content ) {
858
  // Posts in feed
859
  ( $is_feed && isset( $options['display_in_feed'] ) && $options['display_in_feed'] == '-1' ) ||
860
 
 
 
 
861
  // Pages
862
  // Individual pages
863
  ( is_page() && isset( $options['display_in_pages'] ) && $options['display_in_pages'] == '-1' ) ||
3
  Plugin Name: Share Buttons by AddToAny
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. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
+ Version: 1.5.8
7
  Author: AddToAny
8
  Author URI: https://www.addtoany.com/
9
  */
826
  $options = get_option( 'addtoany_options' );
827
  $sharing_disabled = get_post_meta( get_the_ID(), 'sharing_disabled', true );
828
  $sharing_disabled = apply_filters( 'addtoany_sharing_disabled', $sharing_disabled );
829
+ $post_type = get_post_type( get_the_ID() );
830
 
831
  if ( ! $A2A_SHARE_SAVE_auto_placement_ready )
832
  return $content;
859
  // Posts in feed
860
  ( $is_feed && isset( $options['display_in_feed'] ) && $options['display_in_feed'] == '-1' ) ||
861
 
862
+ // Custom post types
863
+ ( $post_type && isset( $options['display_in_cpt_' . $post_type] ) && $options['display_in_cpt_' . $post_type] == '-1' ) ||
864
+
865
  // Pages
866
  // Individual pages
867
  ( is_page() && isset( $options['display_in_pages'] ) && $options['display_in_pages'] == '-1' ) ||
addtoany.admin.php CHANGED
@@ -269,6 +269,13 @@ function A2A_SHARE_SAVE_options_page() {
269
  $new_options['inline_css'] = ( isset( $_POST['A2A_SHARE_SAVE_inline_css'] ) && $_POST['A2A_SHARE_SAVE_inline_css'] == '1') ? '1' : '-1';
270
  $new_options['cache'] = ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) ? '1' : '-1';
271
 
 
 
 
 
 
 
 
272
  // Schedule cache refresh?
273
  if ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) {
274
  A2A_SHARE_SAVE_schedule_cache();
@@ -577,6 +584,20 @@ function A2A_SHARE_SAVE_options_page() {
577
  <input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if ( ! isset( $options['display_in_pages'] ) || $options['display_in_pages'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
578
  <?php printf(__('Display at the %s of pages', 'add-to-any'), position_in_content( $options, false )); ?>
579
  </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  <br/><br/>
581
  <div class="setting-description">
582
  <?php _e("See <a href=\"widgets.php\" title=\"Theme Widgets\">Widgets</a> and <a href=\"options-general.php?page=add-to-any.php&action=floating\" title=\"AddToAny Floating Share Buttons\">Floating</a> for additional placement options. For advanced placement, see <a href=\"http://wordpress.org/plugins/add-to-any/faq/\">the FAQs</a>.", "add-to-any"); ?>
269
  $new_options['inline_css'] = ( isset( $_POST['A2A_SHARE_SAVE_inline_css'] ) && $_POST['A2A_SHARE_SAVE_inline_css'] == '1') ? '1' : '-1';
270
  $new_options['cache'] = ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) ? '1' : '-1';
271
 
272
+ $custom_post_types = array_values( get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ) );
273
+ foreach ( $custom_post_types as $custom_post_type_obj ) {
274
+ $placement_name = $custom_post_type_obj->name;
275
+ $new_options['display_in_cpt_' . $placement_name] = ( isset( $_POST['A2A_SHARE_SAVE_display_in_cpt_' . $placement_name] )
276
+ && $_POST['A2A_SHARE_SAVE_display_in_cpt_' . $placement_name] == '1' ) ? '1' : '-1';
277
+ }
278
+
279
  // Schedule cache refresh?
280
  if ( isset( $_POST['A2A_SHARE_SAVE_cache'] ) && $_POST['A2A_SHARE_SAVE_cache'] == '1' ) {
281
  A2A_SHARE_SAVE_schedule_cache();
584
  <input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if ( ! isset( $options['display_in_pages'] ) || $options['display_in_pages'] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
585
  <?php printf(__('Display at the %s of pages', 'add-to-any'), position_in_content( $options, false )); ?>
586
  </label>
587
+
588
+ <?php
589
+ $custom_post_types = array_values( get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ) );
590
+ foreach ( $custom_post_types as $custom_post_type_obj ) :
591
+ $placement_label = $custom_post_type_obj->labels->name;
592
+ $placement_name = $custom_post_type_obj->name;
593
+ ?>
594
+ <br/>
595
+ <label>
596
+ <input name="A2A_SHARE_SAVE_display_in_cpt_<?php echo $placement_name; ?>" type="checkbox"<?php if ( ! isset( $options['display_in_cpt_' . $placement_name] ) || $options['display_in_cpt_' . $placement_name] != '-1' ) echo ' checked="checked"'; ?> value="1"/>
597
+ <?php printf(__('Display at the %s of %s', 'add-to-any'), position_in_content( $options, false ), esc_html( $placement_label ) ); ?>
598
+ </label>
599
+ <?php endforeach; ?>
600
+
601
  <br/><br/>
602
  <div class="setting-description">
603
  <?php _e("See <a href=\"widgets.php\" title=\"Theme Widgets\">Widgets</a> and <a href=\"options-general.php?page=add-to-any.php&action=floating\" title=\"AddToAny Floating Share Buttons\">Floating</a> for additional placement options. For advanced placement, see <a href=\"http://wordpress.org/plugins/add-to-any/faq/\">the FAQs</a>.", "add-to-any"); ?>
addtoany.min.css CHANGED
@@ -1 +1 @@
1
- .addtoany_share_save_container{clear:both;margin:16px 0}.addtoany_header{margin:0 0 16px}.addtoany_list{display:inline;line-height:16px}.addtoany_list a{display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle}.addtoany_list a img{border:0;height:auto;opacity:1;overflow:hidden;vertical-align:top;width:auto}.addtoany_list a span{display:inline-block;float:none}.addtoany_list.a2a_kit_size_32 a{font-size:32px}.addtoany_list.a2a_kit_size_32 a > span{border-radius:4px;display:inline-block;height:32px;line-height:32px;opacity:1;width:32px}.addtoany_list a .a2a_count{position:relative;vertical-align:top}.addtoany_list a:hover img,.addtoany_list a:hover span{opacity:.7}.addtoany_list a.addtoany_special_service:hover img,.addtoany_list a.addtoany_special_service:hover span{opacity:1}.addtoany_special_service{display:inline-block;vertical-align:middle}.addtoany_special_service a,.addtoany_special_service div,.addtoany_special_service iframe,.addtoany_special_service span{margin:0;vertical-align:baseline!important}.addtoany_special_service iframe{max-width:none}a.addtoany_share_save.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share_save img{border:0;width:auto;height:auto}
1
+ .addtoany_share_save_container{clear:both;margin:16px 0}.addtoany_header{margin:0 0 16px}.addtoany_list{display:inline;line-height:16px}.addtoany_list a{border:0;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle}.addtoany_list a img{border:0;height:auto;opacity:1;overflow:hidden;vertical-align:top;width:auto}.addtoany_list a span{display:inline-block;float:none}.addtoany_list.a2a_kit_size_32 a{font-size:32px}.addtoany_list.a2a_kit_size_32 a > span{border-radius:4px;display:inline-block;height:32px;line-height:32px;opacity:1;width:32px}.addtoany_list a .a2a_count{position:relative;vertical-align:top}.addtoany_list a:hover img,.addtoany_list a:hover span{opacity:.7}.addtoany_list a.addtoany_special_service:hover img,.addtoany_list a.addtoany_special_service:hover span{opacity:1}.addtoany_special_service{display:inline-block;vertical-align:middle}.addtoany_special_service a,.addtoany_special_service div,.addtoany_special_service iframe,.addtoany_special_service span{margin:0;vertical-align:baseline!important}.addtoany_special_service iframe{max-width:none}a.addtoany_share_save.addtoany_no_icon span.a2a_img_text{display:none}a.addtoany_share_save img{border:0;width:auto;height:auto}
addtoany.services.php CHANGED
@@ -266,11 +266,6 @@ $A2A_SHARE_SAVE_services = array(
266
  "name" => "Print",
267
  "icon" => "print",
268
  ),
269
- "print" => array(
270
- "name" => "Print",
271
- "icon" => "print",
272
- "href" => "javascript:print()",
273
- ),
274
  "printfriendly" => array(
275
  "name" => "PrintFriendly",
276
  "icon" => "printfriendly",
@@ -283,10 +278,6 @@ $A2A_SHARE_SAVE_services = array(
283
  "name" => "Pusha",
284
  "icon" => "pusha",
285
  ),
286
- "qq" => array(
287
- "name" => "QQ",
288
- "icon" => "qzone",
289
- ),
290
  "qzone" => array(
291
  "name" => "Qzone",
292
  "icon" => "qzone",
266
  "name" => "Print",
267
  "icon" => "print",
268
  ),
 
 
 
 
 
269
  "printfriendly" => array(
270
  "name" => "PrintFriendly",
271
  "icon" => "printfriendly",
278
  "name" => "Pusha",
279
  "icon" => "pusha",
280
  ),
 
 
 
 
281
  "qzone" => array(
282
  "name" => "Qzone",
283
  "icon" => "qzone",