Contact Widgets - Version 1.5.1

Version Description

  • June 14, 2018 =
  • Tweak: Added a Font Awesome 5 config file with showMissingIcons set to false, to prevent conflicts with plugins and themes using Font Awesome v4.
  • Tweak: Filter the social profile fields array before localizing into admin.js, fixing custom social profile icons.

Props @EvanHerman

Download this release

Release Info

Developer eherman24
Plugin Icon 128x128 Contact Widgets
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5.0 to 1.5.1

assets/js/fontawesome-config.js ADDED
@@ -0,0 +1 @@
 
1
+ window.FontAwesomeConfig = { showMissingIcons: false }
assets/js/fontawesome-config.min.js ADDED
@@ -0,0 +1 @@
 
1
+ window.FontAwesomeConfig={showMissingIcons:!1};
contact-widgets.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Contact Widgets
4
  * Description: Beautifully display social media and contact information on your website with these simple widgets.
5
- * Version: 1.5.0
6
  * Author: GoDaddy
7
  * Author URI: https://godaddy.com
8
  * Text Domain: contact-widgets
@@ -107,15 +107,6 @@ if ( ! class_exists( 'Contact_Widgets' ) ) {
107
 
108
  }
109
 
110
- /**
111
- * Enqueue Font Awesome
112
- */
113
- public function enqueue_font_awesome() {
114
-
115
- wp_enqueue_script( 'font-awesome', self::$fa_url, [], '5.0.6', true );
116
-
117
- }
118
-
119
  /**
120
  * Load languages
121
  *
2
  /**
3
  * Plugin Name: Contact Widgets
4
  * Description: Beautifully display social media and contact information on your website with these simple widgets.
5
+ * Version: 1.5.1
6
  * Author: GoDaddy
7
  * Author URI: https://godaddy.com
8
  * Text Domain: contact-widgets
107
 
108
  }
109
 
 
 
 
 
 
 
 
 
 
110
  /**
111
  * Load languages
112
  *
includes/class-base-widget.php CHANGED
@@ -536,7 +536,7 @@ abstract class Base_Widget extends \WP_Widget {
536
 
537
  include 'social-networks.php';
538
 
539
- wp_localize_script( 'wpcw-admin', 'fieldsArray', $fields );
540
 
541
  if ( $GLOBALS['is_IE'] ) {
542
 
@@ -570,7 +570,9 @@ abstract class Base_Widget extends \WP_Widget {
570
 
571
  wp_enqueue_style( 'wpcw', \Contact_Widgets::$assets_url . "css/style{$rtl}{$suffix}.css", [], Plugin::$version );
572
 
573
- wp_enqueue_script( 'font-awesome', \Contact_Widgets::$fa_url, [], '5.0.6', true );
 
 
574
 
575
  if ( is_customize_preview() ) {
576
 
536
 
537
  include 'social-networks.php';
538
 
539
+ wp_localize_script( 'wpcw-admin', 'fieldsArray', apply_filters( 'wpcw_widget_social_custom_fields', $fields, [] ) );
540
 
541
  if ( $GLOBALS['is_IE'] ) {
542
 
570
 
571
  wp_enqueue_style( 'wpcw', \Contact_Widgets::$assets_url . "css/style{$rtl}{$suffix}.css", [], Plugin::$version );
572
 
573
+ wp_enqueue_script( 'font-awesome-config', \Contact_Widgets::$assets_url . "js/fontawesome-config{$suffix}.js", [], Plugin::$version, true );
574
+
575
+ wp_enqueue_script( 'font-awesome', \Contact_Widgets::$fa_url, [ 'font-awesome-config' ], '5.0.6', true );
576
 
577
  if ( is_customize_preview() ) {
578
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: godaddy, jonathanbardo, fjarrett, eherman24
3
  Tags: widget, contact, social, social icons, social media, facebook, twitter, instagram, linkedin, pinterest
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
- Stable tag: 1.5.0
7
  License: GPL-2.0
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -96,8 +96,38 @@ add_filter( 'wpcw_widget_social_custom_fields', function ( $fields, $instance )
96
  }, 10, 2 );
97
  </pre>
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  == Changelog ==
100
 
 
 
 
 
 
 
101
  = 1.5.0 - May 31, 2018 =
102
 
103
  * New: Add support for "Unsplash" (https://unsplash.com/)
3
  Tags: widget, contact, social, social icons, social media, facebook, twitter, instagram, linkedin, pinterest
4
  Requires at least: 4.4
5
  Tested up to: 4.9
6
+ Stable tag: 1.5.1
7
  License: GPL-2.0
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
96
  }, 10, 2 );
97
  </pre>
98
 
99
+ Since Font Awesome v5, some icons require a 'prefix' value when defining a custom icon. If excluded, the default prefix added to icons is 'fab', for the Font Awesome brand icons. If you are adding an icon that is not a brand icon, you will need to add a prefix. For example, if you wanted to add a [graduation cap icon](https://fontawesome.com/icons/graduation-cap?style=solid) you would need to add `'prefix' => 'fas'` to the attributes array.
100
+
101
+ Here is an example of adding a 'fas' (Solid) icon to the social profiles.
102
+
103
+ <pre lang="php">
104
+ add_filter( 'wpcw_widget_social_custom_fields', function ( $fields, $instance ) {
105
+
106
+ $fields['lattes'] = [
107
+ 'icon' => 'graduation-cap', // See font-awesome icon slug
108
+ 'prefix' => 'fas', // See font-awesome icon prefix
109
+ 'label' => __( 'Service Name', 'YOURTEXTDOMAIN' ),
110
+ 'default' => 'https://example.com/username',
111
+ 'select' => 'username',
112
+ 'sanitizer' => 'esc_url_raw',
113
+ 'escaper' => 'esc_url',
114
+ 'social' => true,
115
+ 'target' => '_blank',
116
+ ];
117
+
118
+ return $fields;
119
+
120
+ }, 10, 2 );
121
+ </pre>
122
+
123
  == Changelog ==
124
 
125
+ = 1.5.1 - June 14, 2018 =
126
+ * Tweak: Added a Font Awesome 5 config file with `showMissingIcons` set to `false`, to prevent conflicts with plugins and themes using Font Awesome v4.
127
+ * Tweak: Filter the social profile fields array before localizing into `admin.js`, fixing custom social profile icons.
128
+
129
+ Props [@EvanHerman](https://github.com/evanherman)
130
+
131
  = 1.5.0 - May 31, 2018 =
132
 
133
  * New: Add support for "Unsplash" (https://unsplash.com/)