Google Fonts for WordPress - Version 1.8.0

Version Description

Download this release

Release Info

Developer DannyCooper
Plugin Icon 128x128 Google Fonts for WordPress
Version 1.8.0
Comparing to
See all releases

Code changes from version 1.7.6 to 1.8.0

assets/css/customize-controls.css CHANGED
@@ -165,7 +165,8 @@
165
 
166
  /* @group Single Chosen */
167
 
168
- .chosen-container-single .chosen-single {
 
169
  display: block;
170
  position: relative;
171
  height: 25px;
165
 
166
  /* @group Single Chosen */
167
 
168
+ .chosen-container-single .chosen-single,
169
+ .chosen-container-multi .chosen-choices {
170
  display: block;
171
  position: relative;
172
  height: 25px;
assets/js/customize-controls.js CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /* global ogf_font_array */
4
  ( function( api ) {
5
- api.controlConstructor.typography = api.Control.extend(
6
  {
7
  ready: function() {
8
  const control = this;
@@ -191,3 +191,19 @@ jQuery( document ).ready( function() {
191
  }
192
  );
193
  } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /* global ogf_font_array */
4
  ( function( api ) {
5
+ api.controlConstructor[ 'typography' ] = api.Control.extend(
6
  {
7
  ready: function() {
8
  const control = this;
191
  }
192
  );
193
  } );
194
+
195
+ /* === Multiple Fonts Control === */
196
+ ( function( api ) {
197
+ api.controlConstructor[ 'typography-multiselect' ] = api.Control.extend( {
198
+ ready: function() {
199
+ const control = this;
200
+ jQuery( 'select', control.container ).change(
201
+ function() {
202
+ let selectValue = jQuery( this ).val();
203
+ selectValue = ( null === selectValue ) ? [] : selectValue;
204
+ control.setting.set( selectValue );
205
+ }
206
+ );
207
+ },
208
+ } );
209
+ }( wp.customize ) );
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  = 1.7.6 =
2
 
3
  * Add global font choices to block editor.
1
+ = 1.8.0 =
2
+
3
+ * Add 'Load Fonts for CSS' option.
4
+ * Add first implementation of compatibility filter (ThemeGrill)
5
+
6
  = 1.7.6 =
7
 
8
  * Add global font choices to block editor.
class-olympus-google-fonts.php CHANGED
@@ -108,7 +108,6 @@ class Olympus_Google_Fonts {
108
  * Register control scripts/styles.
109
  */
110
  public function customize_controls_enqueue() {
111
-
112
  wp_enqueue_script( 'ogf-customize-controls', esc_url( OGF_DIR_URL . 'assets/js/customize-controls.js' ), array( 'customize-controls' ), OGF_VERSION, true );
113
  wp_enqueue_style( 'ogf-customize-controls', esc_url( OGF_DIR_URL . 'assets/css/customize-controls.css' ), array(), OGF_VERSION );
114
 
108
  * Register control scripts/styles.
109
  */
110
  public function customize_controls_enqueue() {
 
111
  wp_enqueue_script( 'ogf-customize-controls', esc_url( OGF_DIR_URL . 'assets/js/customize-controls.js' ), array( 'customize-controls' ), OGF_VERSION, true );
112
  wp_enqueue_style( 'ogf-customize-controls', esc_url( OGF_DIR_URL . 'assets/css/customize-controls.css' ), array(), OGF_VERSION );
113
 
compatability/themegrill.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Compatability file for ThemeGrill themes.
4
+ *
5
+ * @package olympus-google-fonts
6
+ * @copyright Copyright (c) 2019, Fonts Plugin
7
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
+ */
9
+
10
+ /**
11
+ * Modify the default element selectors to improve compatability with ThemeGrill themes.
12
+ *
13
+ * @param array $elements The default elements.
14
+ */
15
+ function ogf_themegrill_elements( $elements ) {
16
+
17
+ $elements['ogf_body']['selectors'] = 'body, p';
18
+ return $elements;
19
+
20
+ }
21
+
22
+ add_filter( 'ogf_elements', 'ogf_themegrill_elements' );
includes/class-ogf-fonts.php CHANGED
@@ -57,6 +57,12 @@ class OGF_Fonts {
57
  }
58
  }
59
 
 
 
 
 
 
 
60
  }
61
 
62
  /**
57
  }
58
  }
59
 
60
+ $load_fonts_css = get_theme_mod( 'ogf_load_fonts', array() );
61
+
62
+ foreach ( $load_fonts_css as $key => $value ) {
63
+ $this->choices[] = $value;
64
+ }
65
+
66
  }
67
 
68
  /**
includes/customizer/controls/class-ogf-customize-multiple-fonts-control.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Fonts Custom Control
4
+ *
5
+ * @package olympus-google-fonts
6
+ * @copyright Copyright (c) 2019, Fonts Plugin
7
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
+ */
9
+
10
+ /**
11
+ * Fonts control class.
12
+ */
13
+ class OGF_Customize_Multiple_Fonts_Control extends WP_Customize_Control {
14
+
15
+ /**
16
+ * The type of customize control being rendered.
17
+ *
18
+ * @var string
19
+ */
20
+ public $type = 'typography-multiselect';
21
+
22
+ /**
23
+ * Enqueue scripts/styles for the color picker.
24
+ */
25
+ public function enqueue() {
26
+ wp_enqueue_script( 'chosen', esc_url( OGF_DIR_URL . 'assets/js/chosen.min.js' ), array( 'jquery' ), OGF_VERSION, true );
27
+ }
28
+
29
+ /**
30
+ * Add custom parameters to pass to the JS via JSON.
31
+ */
32
+ public function to_json() {
33
+ parent::to_json();
34
+ // The setting value.
35
+ $this->json['id'] = $this->id;
36
+ $this->json['value'] = $this->value();
37
+ $this->json['link'] = $this->get_link();
38
+ }
39
+
40
+ /**
41
+ * Underscore JS template to handle the control's output.
42
+ */
43
+ public function content_template() {
44
+ ?>
45
+ <# if ( data.label ) { #>
46
+ <span class="customize-control-title">{{ data.label }}</span>
47
+ <# } #>
48
+
49
+ <# if ( data.description ) { #>
50
+ <span class="description customize-control-description">{{{ data.description }}}</span>
51
+ <# } #>
52
+
53
+ <# if ( typeof ogf_font_array != 'undefined' ) { #>
54
+ <select data-placeholder="Choose some fonts..." multiple class="ogf-select" {{{ data.link }}}>
55
+ <# _.each( ogf_font_array, function( font_data, font_id ) { #>
56
+ <option value="{{ font_id }}">{{ font_data.family }}</option>
57
+ <# } ) #>
58
+ </select>
59
+ <# } #>
60
+
61
+ <?php
62
+ }
63
+
64
+ }
includes/customizer/panels.php CHANGED
@@ -90,7 +90,7 @@ function ogf_panels_customize_register( $wp_customize ) {
90
  'ogf_debugging',
91
  array(
92
  'title' => esc_html__( 'Debugging', 'olympus-google-fonts' ),
93
- 'priority' => '7',
94
  'panel' => 'ogf_google_fonts',
95
  )
96
  );
90
  'ogf_debugging',
91
  array(
92
  'title' => esc_html__( 'Debugging', 'olympus-google-fonts' ),
93
+ 'priority' => '8',
94
  'panel' => 'ogf_google_fonts',
95
  )
96
  );
includes/customizer/settings.php CHANGED
@@ -13,11 +13,13 @@
13
  * @param object $wp_customize Access to the $wp_customize object.
14
  */
15
  function ogf_customize_register( $wp_customize ) {
 
16
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-typography-control.php';
17
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-repeater-control.php';
18
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-upsell-control.php';
19
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-multiple-checkbox-control.php';
20
 
 
21
  $wp_customize->register_control_type( 'OGF_Customize_Multiple_Checkbox_Control' );
22
  $wp_customize->register_control_type( 'OGF_Customize_Typography_Control' );
23
 
@@ -28,16 +30,36 @@ function ogf_customize_register( $wp_customize ) {
28
  )
29
  );
30
 
31
- $wp_customize->add_control(
32
- new OGF_Customize_Repeater_Control(
33
- $wp_customize,
34
- 'ogf_custom_selectors',
35
- array(
36
- 'label' => esc_html__( 'Custom Elements', 'customizer-repeater' ),
37
- 'section' => 'ogf_custom',
38
- )
39
  )
40
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  /**
43
  * Build customizer controls.
@@ -210,7 +232,8 @@ function ogf_customize_register( $wp_customize ) {
210
  $wp_customize,
211
  'ogf_upsell_' . $loc,
212
  array(
213
- 'section' => $loc,
 
214
  )
215
  )
216
  );
13
  * @param object $wp_customize Access to the $wp_customize object.
14
  */
15
  function ogf_customize_register( $wp_customize ) {
16
+ require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-multiple-fonts-control.php';
17
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-typography-control.php';
18
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-repeater-control.php';
19
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-upsell-control.php';
20
  require OGF_DIR_PATH . 'includes/customizer/controls/class-ogf-customize-multiple-checkbox-control.php';
21
 
22
+ $wp_customize->register_control_type( 'OGF_Customize_Multiple_Fonts_Control' );
23
  $wp_customize->register_control_type( 'OGF_Customize_Multiple_Checkbox_Control' );
24
  $wp_customize->register_control_type( 'OGF_Customize_Typography_Control' );
25
 
30
  )
31
  );
32
 
33
+ $wp_customize->add_control(
34
+ new OGF_Customize_Repeater_Control(
35
+ $wp_customize,
36
+ 'ogf_custom_selectors',
37
+ array(
38
+ 'label' => esc_html__( 'Custom Elements', 'olympus-google-fonts' ),
39
+ 'section' => 'ogf_custom',
 
40
  )
41
+ )
42
+ );
43
+
44
+ $wp_customize->add_setting(
45
+ 'ogf_load_fonts',
46
+ array(
47
+ 'transport' => 'postMessage',
48
+ )
49
+ );
50
+
51
+ $wp_customize->add_control(
52
+ new OGF_Customize_Multiple_Fonts_Control(
53
+ $wp_customize,
54
+ 'ogf_load_fonts',
55
+ array(
56
+ 'label' => esc_html__( 'Load Fonts for CSS', 'olympus-google-fonts' ),
57
+ 'description' => esc_html__( 'Load fonts but don\'t automatically assign them to an element.', 'olympus-google-fonts' ),
58
+ 'section' => 'ogf_basic',
59
+ 'priority' => '90',
60
+ )
61
+ )
62
+ );
63
 
64
  /**
65
  * Build customizer controls.
232
  $wp_customize,
233
  'ogf_upsell_' . $loc,
234
  array(
235
+ 'section' => $loc,
236
+ 'priority' => 120,
237
  )
238
  )
239
  );
includes/functions.php CHANGED
@@ -80,37 +80,37 @@ function ogf_get_elements() {
80
  'label' => esc_html__( 'Title and H1 Typography', 'olympus-google-fonts' ),
81
  'description' => esc_html__( 'Select and configure the font for your title and H1 headings.', 'olympus-google-fonts' ),
82
  'section' => 'ogf_advanced__content',
83
- 'selectors' => '.entry-title, .entry-title a, .post-title, .post-title a, .page-title, .entry-content h1',
84
  ),
85
  'ogf_post_page_h2' => array(
86
  'label' => esc_html__( 'H2 Typography', 'olympus-google-fonts' ),
87
  'description' => esc_html__( 'Select and configure the font for your H2 headings.', 'olympus-google-fonts' ),
88
  'section' => 'ogf_advanced__content',
89
- 'selectors' => '.entry-content h2, .post-content h2, .page-content h2',
90
  ),
91
  'ogf_post_page_h3' => array(
92
  'label' => esc_html__( 'H3 Typography', 'olympus-google-fonts' ),
93
  'description' => esc_html__( 'Select and configure the font for your H3 headings.', 'olympus-google-fonts' ),
94
  'section' => 'ogf_advanced__content',
95
- 'selectors' => '.entry-content h3, .post-content h3, .page-content h3',
96
  ),
97
  'ogf_post_page_h4' => array(
98
  'label' => esc_html__( 'H4 Typography', 'olympus-google-fonts' ),
99
  'description' => esc_html__( 'Select and configure the font for your H4 headings.', 'olympus-google-fonts' ),
100
  'section' => 'ogf_advanced__content',
101
- 'selectors' => '.entry-content h4, .post-content h4, .page-content h4',
102
  ),
103
  'ogf_post_page_h5' => array(
104
  'label' => esc_html__( 'H5 Typography', 'olympus-google-fonts' ),
105
  'description' => esc_html__( 'Select and configure the font for your H5 headings.', 'olympus-google-fonts' ),
106
  'section' => 'ogf_advanced__content',
107
- 'selectors' => '.entry-content h5, .post-content h5, .page-content h5',
108
  ),
109
  'ogf_post_page_h6' => array(
110
  'label' => esc_html__( 'H6 Typography', 'olympus-google-fonts' ),
111
  'description' => esc_html__( 'Select and configure the font for your H6 headings.', 'olympus-google-fonts' ),
112
  'section' => 'ogf_advanced__content',
113
- 'selectors' => '.entry-content h6, .post-content h6, .page-content h6',
114
  ),
115
  'ogf_sidebar_headings' => array(
116
  'label' => esc_html__( 'Headings Typography', 'olympus-google-fonts' ),
80
  'label' => esc_html__( 'Title and H1 Typography', 'olympus-google-fonts' ),
81
  'description' => esc_html__( 'Select and configure the font for your title and H1 headings.', 'olympus-google-fonts' ),
82
  'section' => 'ogf_advanced__content',
83
+ 'selectors' => '.entry-title, .entry-title a, .post-title, .post-title a, .page-title, .entry-content h1, #content h1',
84
  ),
85
  'ogf_post_page_h2' => array(
86
  'label' => esc_html__( 'H2 Typography', 'olympus-google-fonts' ),
87
  'description' => esc_html__( 'Select and configure the font for your H2 headings.', 'olympus-google-fonts' ),
88
  'section' => 'ogf_advanced__content',
89
+ 'selectors' => '.entry-content h2, .post-content h2, .page-content h2, #content h2',
90
  ),
91
  'ogf_post_page_h3' => array(
92
  'label' => esc_html__( 'H3 Typography', 'olympus-google-fonts' ),
93
  'description' => esc_html__( 'Select and configure the font for your H3 headings.', 'olympus-google-fonts' ),
94
  'section' => 'ogf_advanced__content',
95
+ 'selectors' => '.entry-content h3, .post-content h3, .page-content h3, #content h3',
96
  ),
97
  'ogf_post_page_h4' => array(
98
  'label' => esc_html__( 'H4 Typography', 'olympus-google-fonts' ),
99
  'description' => esc_html__( 'Select and configure the font for your H4 headings.', 'olympus-google-fonts' ),
100
  'section' => 'ogf_advanced__content',
101
+ 'selectors' => '.entry-content h4, .post-content h4, .page-content h4, #content h4',
102
  ),
103
  'ogf_post_page_h5' => array(
104
  'label' => esc_html__( 'H5 Typography', 'olympus-google-fonts' ),
105
  'description' => esc_html__( 'Select and configure the font for your H5 headings.', 'olympus-google-fonts' ),
106
  'section' => 'ogf_advanced__content',
107
+ 'selectors' => '.entry-content h5, .post-content h5, .page-content h5, #content h5',
108
  ),
109
  'ogf_post_page_h6' => array(
110
  'label' => esc_html__( 'H6 Typography', 'olympus-google-fonts' ),
111
  'description' => esc_html__( 'Select and configure the font for your H6 headings.', 'olympus-google-fonts' ),
112
  'section' => 'ogf_advanced__content',
113
+ 'selectors' => '.entry-content h6, .post-content h6, .page-content h6, #content h6',
114
  ),
115
  'ogf_sidebar_headings' => array(
116
  'label' => esc_html__( 'Headings Typography', 'olympus-google-fonts' ),
olympus-google-fonts.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * Google Fonts for WordPress
4
  *
5
- * Plugin Name: Google Fonts for WordPress
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
- * Description: The easiest to use Google Fonts plugin. No coding required. 870+ font choices.
8
- * Version: 1.7.6
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_campaign=heading
11
  * Text Domain: olympus-google-fonts
@@ -18,7 +18,7 @@
18
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
19
  */
20
 
21
- define( 'OGF_VERSION', '1.7.6' );
22
  define( 'OGF_DIR_PATH', plugin_dir_path( __FILE__ ) );
23
  define( 'OGF_DIR_URL', plugin_dir_url( __FILE__ ) );
24
 
@@ -26,3 +26,11 @@ require OGF_DIR_PATH . 'class-olympus-google-fonts.php';
26
  require OGF_DIR_PATH . 'blocks/init.php';
27
 
28
  $gfwp = new Olympus_Google_Fonts();
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * Google Fonts Typography
4
  *
5
+ * Plugin Name: Google Fonts Typography
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
+ * Description: The easiest to use Google Fonts typography plugin. No coding required. 870+ font choices.
8
+ * Version: 1.8.0
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_campaign=heading
11
  * Text Domain: olympus-google-fonts
18
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
19
  */
20
 
21
+ define( 'OGF_VERSION', '1.8.0' );
22
  define( 'OGF_DIR_PATH', plugin_dir_path( __FILE__ ) );
23
  define( 'OGF_DIR_URL', plugin_dir_url( __FILE__ ) );
24
 
26
  require OGF_DIR_PATH . 'blocks/init.php';
27
 
28
  $gfwp = new Olympus_Google_Fonts();
29
+
30
+ $current_theme = wp_get_theme();
31
+ $theme_author = strtolower( esc_attr( $current_theme->get( 'Author' ) ) );
32
+ $author_compat_path = OGF_DIR_PATH . '/compatability/' . $theme_author . '.php';
33
+
34
+ if ( file_exists( $author_compat_path ) ) {
35
+ require $author_compat_path;
36
+ }
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
- === Google Fonts for WordPress ===
2
  Contributors: DannyCooper, googlefonts
3
  Tags: google, fonts, google fonts, google fonts for wordpress, typography
4
  Donate link: https://fontsplugin.com/#pricing
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
  License: GPLv2 or later
8
- Stable tag: 1.7.6
9
 
10
- The easiest to use Google Fonts Plugin. No coding required. 870+ font choices.
11
 
12
  == Description ==
13
  The [Google Fonts](https://fontsplugin.com/?utm_source=wporg&utm_campaign=intro) library currently contains 877 unique fonts. This plugin allows you to easily use any of them on your WordPress website.
1
+ === Google Fonts Typography ===
2
  Contributors: DannyCooper, googlefonts
3
  Tags: google, fonts, google fonts, google fonts for wordpress, typography
4
  Donate link: https://fontsplugin.com/#pricing
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
  License: GPLv2 or later
8
+ Stable tag: 1.8.0
9
 
10
+ The easiest to use Google Fonts Typography Plugin. No coding required. 870+ font choices.
11
 
12
  == Description ==
13
  The [Google Fonts](https://fontsplugin.com/?utm_source=wporg&utm_campaign=intro) library currently contains 877 unique fonts. This plugin allows you to easily use any of them on your WordPress website.