Google Fonts for WordPress - Version 1.1.0

Version Description

Release Date - Dec 30 2017

  • Improve outputting of Google stylesheet
Download this release

Release Info

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

Code changes from version 1.0.9 to 1.1.0

class-olympus-google-fonts.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Main Olympus_Google_Fonts Class
4
+ *
5
+ * @package olympus-google-fonts
6
+ * @copyright Copyright (c) 2017, Danny Cooper
7
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
+ */
9
+
10
+ /**
11
+ * Main Olympus_Google_Fonts Class
12
+ */
13
+ class Olympus_Google_Fonts {
14
+
15
+ /**
16
+ * Initialize plugin.
17
+ */
18
+ public function __construct() {
19
+
20
+ $this->includes();
21
+
22
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) );
23
+
24
+ }
25
+
26
+ /**
27
+ * Load plugin files.
28
+ */
29
+ public function includes() {
30
+
31
+ // Required files for building the Google Fonts URL.
32
+ require plugin_dir_path( __FILE__ ) . 'includes/functions.php';
33
+ require plugin_dir_path( __FILE__ ) . 'includes/class-ogf-google-url.php';
34
+
35
+ // Required files for the customizer settings.
36
+ require plugin_dir_path( __FILE__ ) . 'includes/customizer/settings.php';
37
+ require plugin_dir_path( __FILE__ ) . 'includes/customizer/output-css.php';
38
+
39
+ }
40
+
41
+ /**
42
+ * Load plugin textdomain.
43
+ */
44
+ public function load_textdomain() {
45
+
46
+ load_plugin_textdomain( 'olympus-google-fonts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
47
+
48
+ }
49
+
50
+ /**
51
+ * Enqeue the Google Fonts URL.
52
+ */
53
+ public function enqueue() {
54
+
55
+ $url = new OGF_Google_URL();
56
+
57
+ if ( $url->has_custom_fonts() ) {
58
+ wp_enqueue_style( 'olympus-google-fonts', $url->build() );
59
+ }
60
+
61
+ }
62
+
63
+ }
includes/{class-google-url.php → class-ogf-google-url.php} RENAMED
@@ -12,13 +12,6 @@
12
  */
13
  class OGF_Google_URL {
14
 
15
- /**
16
- * All Google Fonts start with this URL
17
- *
18
- * @var string
19
- */
20
- public $url_base = 'https://fonts.googleapis.com/css?family=';
21
-
22
  /**
23
  * All Google Fonts start with this URL
24
  *
@@ -57,6 +50,15 @@ class OGF_Google_URL {
57
  'ogf_body_font',
58
  'ogf_headings_font',
59
  'ogf_inputs_font',
 
 
 
 
 
 
 
 
 
60
  );
61
 
62
  foreach ( $options as $option ) {
@@ -96,11 +98,11 @@ class OGF_Google_URL {
96
  public function build() {
97
 
98
  $families = array();
99
- $subsets = array();
100
 
101
  if ( ! empty( $this->choices ) ) {
102
 
103
- foreach ( $this->choices as $font ) {
104
 
105
  // Check the users choice is a real font.
106
  if ( array_key_exists( $font, $this->google_fonts ) ) {
@@ -121,10 +123,12 @@ class OGF_Google_URL {
121
  }
122
  }
123
 
124
- $families_output = implode( '|', $families );
125
- $subset_output = implode( ',', $subsets );
 
 
126
 
127
- return $this->url_base . $families_output . '&amp;' . $subset_output;
128
 
129
  }
130
 
12
  */
13
  class OGF_Google_URL {
14
 
 
 
 
 
 
 
 
15
  /**
16
  * All Google Fonts start with this URL
17
  *
50
  'ogf_body_font',
51
  'ogf_headings_font',
52
  'ogf_inputs_font',
53
+ 'ogf_site_title_font',
54
+ 'ogf_site_description_font',
55
+ 'ogf_navigation_font',
56
+ 'ogf_post_page_headings_font',
57
+ 'ogf_post_page_content_font',
58
+ 'ogf_sidebar_headings_font',
59
+ 'ogf_sidebar_content_font',
60
+ 'ogf_footer_headings_font',
61
+ 'ogf_footer_content_font',
62
  );
63
 
64
  foreach ( $options as $option ) {
98
  public function build() {
99
 
100
  $families = array();
101
+ $subsets = array();
102
 
103
  if ( ! empty( $this->choices ) ) {
104
 
105
+ foreach ( array_unique( $this->choices ) as $font ) {
106
 
107
  // Check the users choice is a real font.
108
  if ( array_key_exists( $font, $this->google_fonts ) ) {
123
  }
124
  }
125
 
126
+ $query_args = array(
127
+ 'family' => implode( '|', $families ),
128
+ 'subset' => implode( ',', $subsets ),
129
+ );
130
 
131
+ return add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
132
 
133
  }
134
 
includes/customizer/output-css.php CHANGED
@@ -12,9 +12,8 @@
12
  */
13
  function ogf_output_css() {
14
  ?>
15
- <!-- Olympus Google Fonts CSS-->
16
- <style type="text/css">
17
-
18
  <?php ogf_generate_css( 'body', 'ogf_body_font' ); ?>
19
  <?php ogf_generate_css( '.site-title, h1, h2, h3, h4, h5, h6', 'ogf_headings_font' ); ?>
20
  <?php ogf_generate_css( 'button, input, select, textarea', 'ogf_inputs_font' ); ?>
@@ -23,21 +22,20 @@ function ogf_output_css() {
23
 
24
  <?php ogf_generate_css( '.site-title', 'ogf_site_title_font' ); ?>
25
  <?php ogf_generate_css( '.site-description', 'ogf_site_description_font' ); ?>
26
- <?php ogf_generate_css( '.menu', 'ogf_navigation_font' ); ?>
27
  <?php ogf_generate_css( 'article h1, article h2, article h3, article h4, article h5, article h6', 'ogf_post_page_headings_font' ); ?>
28
  <?php ogf_generate_css( 'article', 'ogf_post_page_content_font' ); ?>
29
  <?php ogf_generate_css( '.widget-area h1, .widget-area h2, .widget-area h3, .widget-area h4, .widgets-area h5, .widget-area h6', 'ogf_sidebar_headings_font' ); ?>
30
  <?php ogf_generate_css( '.widget-area', 'ogf_sidebar_content_font' ); ?>
31
  <?php ogf_generate_css( 'footer h1, footer h2, footer h3, footer h4, .widgets-area h5, footer h6', 'ogf_footer_headings_font' ); ?>
32
  <?php ogf_generate_css( 'footer', 'ogf_footer_content_font' ); ?>
33
-
34
  </style>
35
- <!--/Customizer CSS-->
36
  <?php
37
  }
38
 
39
  // Output custom CSS to live site.
40
- add_action( 'wp_head' , 'ogf_output_css' );
41
 
42
  /**
43
  * Helper function to build the CSS styles.
@@ -53,7 +51,7 @@ function ogf_generate_css( $selector, $option_name ) {
53
  $stack = ogf_build_font_stack( get_theme_mod( $option_name ) );
54
 
55
  if ( ! empty( $stack ) && 'default' !== $stack ) {
56
- $return = sprintf('%s { font-family: %s; }',
57
  $selector,
58
  $stack . ogf_is_forced()
59
  );
12
  */
13
  function ogf_output_css() {
14
  ?>
15
+ <!-- Olympus Google Fonts CSS -->
16
+ <style>
 
17
  <?php ogf_generate_css( 'body', 'ogf_body_font' ); ?>
18
  <?php ogf_generate_css( '.site-title, h1, h2, h3, h4, h5, h6', 'ogf_headings_font' ); ?>
19
  <?php ogf_generate_css( 'button, input, select, textarea', 'ogf_inputs_font' ); ?>
22
 
23
  <?php ogf_generate_css( '.site-title', 'ogf_site_title_font' ); ?>
24
  <?php ogf_generate_css( '.site-description', 'ogf_site_description_font' ); ?>
25
+ <?php ogf_generate_css( '.menu, .page_item, .menu-item', 'ogf_navigation_font' ); ?>
26
  <?php ogf_generate_css( 'article h1, article h2, article h3, article h4, article h5, article h6', 'ogf_post_page_headings_font' ); ?>
27
  <?php ogf_generate_css( 'article', 'ogf_post_page_content_font' ); ?>
28
  <?php ogf_generate_css( '.widget-area h1, .widget-area h2, .widget-area h3, .widget-area h4, .widgets-area h5, .widget-area h6', 'ogf_sidebar_headings_font' ); ?>
29
  <?php ogf_generate_css( '.widget-area', 'ogf_sidebar_content_font' ); ?>
30
  <?php ogf_generate_css( 'footer h1, footer h2, footer h3, footer h4, .widgets-area h5, footer h6', 'ogf_footer_headings_font' ); ?>
31
  <?php ogf_generate_css( 'footer', 'ogf_footer_content_font' ); ?>
 
32
  </style>
33
+ <!-- Olympus Google Fonts CSS -->
34
  <?php
35
  }
36
 
37
  // Output custom CSS to live site.
38
+ add_action( 'wp_head', 'ogf_output_css' );
39
 
40
  /**
41
  * Helper function to build the CSS styles.
51
  $stack = ogf_build_font_stack( get_theme_mod( $option_name ) );
52
 
53
  if ( ! empty( $stack ) && 'default' !== $stack ) {
54
+ $return = sprintf('%s { font-family: %s; }' . PHP_EOL,
55
  $selector,
56
  $stack . ogf_is_forced()
57
  );
includes/customizer/settings.php CHANGED
@@ -15,209 +15,208 @@
15
  function ogf_customize_register( $wp_customize ) {
16
 
17
  $wp_customize->add_panel( 'olympus_google_fonts', array(
18
- 'priority' => 10,
19
- 'capability' => 'edit_theme_options',
20
  'theme_supports' => '',
21
- 'title' => esc_html__( 'Google Fonts', 'textdomain' ),
22
- 'description' => esc_html__( 'Description of what this panel does.', 'textdomain' ),
23
  ) );
24
 
25
- $wp_customize->add_section( 'olympus-google-fonts' , array(
26
- 'title' => esc_html__( 'Basic Settings', 'olympus-google-fonts' ),
27
- 'priority' => 1,
28
- 'panel' => 'olympus_google_fonts',
29
  ) );
30
 
31
- $wp_customize->add_setting( 'ogf_body_font' , array(
32
  'default' => 'default',
33
  'transport' => 'refresh',
34
  ) );
35
 
36
  $wp_customize->add_control( 'body_font', array(
37
- 'label' => esc_html__( 'Body Font', 'olympus-google-fonts' ),
38
- 'section' => 'olympus-google-fonts',
39
- 'settings' => 'ogf_body_font',
40
- 'type' => 'select',
41
  'choices' => ogf_font_choices_for_select(),
42
  ) );
43
 
44
- $wp_customize->add_setting( 'ogf_headings_font' , array(
45
  'default' => 'default',
46
  'transport' => 'refresh',
47
  ) );
48
 
49
  $wp_customize->add_control( 'headings_font', array(
50
- 'label' => esc_html__( 'Headings Font', 'olympus-google-fonts' ),
51
- 'section' => 'olympus-google-fonts',
52
- 'settings' => 'ogf_headings_font',
53
- 'type' => 'select',
54
  'choices' => ogf_font_choices_for_select(),
55
  ) );
56
 
57
- $wp_customize->add_setting( 'ogf_inputs_font' , array(
58
  'default' => 'default',
59
  'transport' => 'refresh',
60
  ) );
61
 
62
  $wp_customize->add_control( 'inputs_font', array(
63
- 'label' => esc_html__( 'Buttons and Inputs Font', 'olympus-google-fonts' ),
64
- 'section' => 'olympus-google-fonts',
65
- 'settings' => 'ogf_inputs_font',
66
- 'type' => 'select',
67
  'choices' => ogf_font_choices_for_select(),
68
  ) );
69
 
70
- $wp_customize->add_setting( 'ogf_force_styles' , array(
71
- 'default' => '',
72
- 'transport' => 'refresh',
73
  'sanitize_callback' => 'ogf_sanitize_checkbox',
74
  ) );
75
 
76
  $wp_customize->add_control( 'force_styles', array(
77
- 'label' => esc_html__( 'Force Styles?', 'olympus-google-fonts' ),
78
- 'section' => 'olympus-google-fonts',
79
- 'settings' => 'ogf_force_styles',
80
- 'type' => 'checkbox',
81
  'description' => esc_html__( 'If your choices are not displaying correctly, check this box.', 'olympus-google-fonts' ),
82
  ) );
83
 
84
  /* Advanced Settings */
85
 
86
- $wp_customize->add_section( 'olympus-google-fonts-advanced' , array(
87
- 'title' => esc_html__( 'Advanced Settings', 'olympus-google-fonts' ),
88
- 'priority' => 1,
89
- 'panel' => 'olympus_google_fonts',
90
- 'description' => esc_html__( 'Advanced settings allow fine-grain control and overwrite the basic settings.', 'olympus-google-fonts' ),
91
  ) );
92
 
93
- $wp_customize->add_setting( 'ogf_site_title_font' , array(
94
  'default' => 'default',
95
  'transport' => 'refresh',
96
  ) );
97
 
98
  $wp_customize->add_control( 'site_title_font', array(
99
- 'label' => esc_html__( 'Site Title Font', 'olympus-google-fonts' ),
100
- 'section' => 'olympus-google-fonts-advanced',
101
- 'settings' => 'ogf_site_title_font',
102
- 'type' => 'select',
103
  'choices' => ogf_font_choices_for_select(),
104
  ) );
105
 
106
- $wp_customize->add_setting( 'ogf_site_description_font' , array(
107
  'default' => 'default',
108
  'transport' => 'refresh',
109
  ) );
110
 
111
  $wp_customize->add_control( 'site_description_font', array(
112
- 'label' => esc_html__( 'Site Description Font', 'olympus-google-fonts' ),
113
- 'section' => 'olympus-google-fonts-advanced',
114
- 'settings' => 'ogf_site_description_font',
115
- 'type' => 'select',
116
  'choices' => ogf_font_choices_for_select(),
117
  ) );
118
 
119
- $wp_customize->add_setting( 'ogf_navigation_font' , array(
120
  'default' => 'default',
121
  'transport' => 'refresh',
122
  ) );
123
 
124
  $wp_customize->add_control( 'navigation_font', array(
125
- 'label' => esc_html__( 'Navigation Font', 'olympus-google-fonts' ),
126
- 'section' => 'olympus-google-fonts-advanced',
127
- 'settings' => 'ogf_navigation_font',
128
- 'type' => 'select',
129
  'choices' => ogf_font_choices_for_select(),
130
  ) );
131
 
132
- $wp_customize->add_setting( 'ogf_post_page_headings_font' , array(
133
  'default' => 'default',
134
  'transport' => 'refresh',
135
  ) );
136
 
137
  $wp_customize->add_control( 'post_page_headings_font', array(
138
- 'label' => esc_html__( 'Post/Page Headings Font', 'olympus-google-fonts' ),
139
- 'section' => 'olympus-google-fonts-advanced',
140
- 'settings' => 'ogf_post_page_headings_font',
141
- 'type' => 'select',
142
  'choices' => ogf_font_choices_for_select(),
143
  ) );
144
 
145
- $wp_customize->add_setting( 'ogf_post_page_content_font' , array(
146
  'default' => 'default',
147
  'transport' => 'refresh',
148
  ) );
149
 
150
  $wp_customize->add_control( 'post_page_content_font', array(
151
- 'label' => esc_html__( 'Post/Page Content Font', 'olympus-google-fonts' ),
152
- 'section' => 'olympus-google-fonts-advanced',
153
- 'settings' => 'ogf_post_page_content_font',
154
- 'type' => 'select',
155
  'choices' => ogf_font_choices_for_select(),
156
  ) );
157
 
158
- $wp_customize->add_setting( 'ogf_sidebar_headings_font' , array(
159
  'default' => 'default',
160
  'transport' => 'refresh',
161
  ) );
162
 
163
  $wp_customize->add_control( 'sidebar_headings_font', array(
164
- 'label' => esc_html__( 'Sidebar Headings Font', 'olympus-google-fonts' ),
165
- 'section' => 'olympus-google-fonts-advanced',
166
- 'settings' => 'ogf_sidebar_headings_font',
167
- 'type' => 'select',
168
  'choices' => ogf_font_choices_for_select(),
169
  ) );
170
 
171
- $wp_customize->add_setting( 'ogf_sidebar_content_font' , array(
172
  'default' => 'default',
173
  'transport' => 'refresh',
174
  ) );
175
 
176
  $wp_customize->add_control( 'sidebar_content_font', array(
177
- 'label' => esc_html__( 'Sidebar Content Font', 'olympus-google-fonts' ),
178
- 'section' => 'olympus-google-fonts-advanced',
179
- 'settings' => 'ogf_sidebar_content_font',
180
- 'type' => 'select',
181
  'choices' => ogf_font_choices_for_select(),
182
  ) );
183
 
184
- $wp_customize->add_setting( 'ogf_footer_headings_font' , array(
185
  'default' => 'default',
186
  'transport' => 'refresh',
187
  ) );
188
 
189
  $wp_customize->add_control( 'footer_headings_font', array(
190
- 'label' => esc_html__( 'Footer Headings Font', 'olympus-google-fonts' ),
191
- 'section' => 'olympus-google-fonts-advanced',
192
- 'settings' => 'ogf_footer_headings_font',
193
- 'type' => 'select',
194
  'choices' => ogf_font_choices_for_select(),
195
  ) );
196
 
197
- $wp_customize->add_setting( 'ogf_footer_content_font' , array(
198
  'default' => 'default',
199
  'transport' => 'refresh',
200
  ) );
201
 
202
  $wp_customize->add_control( 'footer_content_font', array(
203
- 'label' => esc_html__( 'Footer Content Font', 'olympus-google-fonts' ),
204
- 'section' => 'olympus-google-fonts-advanced',
205
- 'settings' => 'ogf_footer_content_font',
206
- 'type' => 'select',
207
  'choices' => ogf_font_choices_for_select(),
208
  ) );
209
 
210
- $wp_customize->add_setting( 'ogf_force_advanced_styles' , array(
211
- 'default' => '',
212
- 'transport' => 'refresh',
213
  'sanitize_callback' => 'ogf_sanitize_checkbox',
214
  ) );
215
 
216
  $wp_customize->add_control( 'force_advanced_styles', array(
217
- 'label' => esc_html__( 'Force Advanced Styles?', 'olympus-google-fonts' ),
218
- 'section' => 'olympus-google-fonts-advanced',
219
- 'settings' => 'ogf_force_advanced_styles',
220
- 'type' => 'checkbox',
221
  'description' => esc_html__( 'If your choices are not displaying correctly, check this box.', 'olympus-google-fonts' ),
222
  ) );
223
 
15
  function ogf_customize_register( $wp_customize ) {
16
 
17
  $wp_customize->add_panel( 'olympus_google_fonts', array(
18
+ 'priority' => 10,
19
+ 'capability' => 'edit_theme_options',
20
  'theme_supports' => '',
21
+ 'title' => esc_html__( 'Google Fonts', 'olympus-google-fonts' ),
 
22
  ) );
23
 
24
+ $wp_customize->add_section( 'olympus-google-fonts', array(
25
+ 'title' => esc_html__( 'Basic Settings', 'olympus-google-fonts' ),
26
+ 'priority' => 1,
27
+ 'panel' => 'olympus_google_fonts',
28
  ) );
29
 
30
+ $wp_customize->add_setting( 'ogf_body_font', array(
31
  'default' => 'default',
32
  'transport' => 'refresh',
33
  ) );
34
 
35
  $wp_customize->add_control( 'body_font', array(
36
+ 'label' => esc_html__( 'Body Font', 'olympus-google-fonts' ),
37
+ 'section' => 'olympus-google-fonts',
38
+ 'settings' => 'ogf_body_font',
39
+ 'type' => 'select',
40
  'choices' => ogf_font_choices_for_select(),
41
  ) );
42
 
43
+ $wp_customize->add_setting( 'ogf_headings_font', array(
44
  'default' => 'default',
45
  'transport' => 'refresh',
46
  ) );
47
 
48
  $wp_customize->add_control( 'headings_font', array(
49
+ 'label' => esc_html__( 'Headings Font', 'olympus-google-fonts' ),
50
+ 'section' => 'olympus-google-fonts',
51
+ 'settings' => 'ogf_headings_font',
52
+ 'type' => 'select',
53
  'choices' => ogf_font_choices_for_select(),
54
  ) );
55
 
56
+ $wp_customize->add_setting( 'ogf_inputs_font', array(
57
  'default' => 'default',
58
  'transport' => 'refresh',
59
  ) );
60
 
61
  $wp_customize->add_control( 'inputs_font', array(
62
+ 'label' => esc_html__( 'Buttons and Inputs Font', 'olympus-google-fonts' ),
63
+ 'section' => 'olympus-google-fonts',
64
+ 'settings' => 'ogf_inputs_font',
65
+ 'type' => 'select',
66
  'choices' => ogf_font_choices_for_select(),
67
  ) );
68
 
69
+ $wp_customize->add_setting( 'ogf_force_styles', array(
70
+ 'default' => '',
71
+ 'transport' => 'refresh',
72
  'sanitize_callback' => 'ogf_sanitize_checkbox',
73
  ) );
74
 
75
  $wp_customize->add_control( 'force_styles', array(
76
+ 'label' => esc_html__( 'Force Styles?', 'olympus-google-fonts' ),
77
+ 'section' => 'olympus-google-fonts',
78
+ 'settings' => 'ogf_force_styles',
79
+ 'type' => 'checkbox',
80
  'description' => esc_html__( 'If your choices are not displaying correctly, check this box.', 'olympus-google-fonts' ),
81
  ) );
82
 
83
  /* Advanced Settings */
84
 
85
+ $wp_customize->add_section( 'olympus-google-fonts-advanced', array(
86
+ 'title' => esc_html__( 'Advanced Settings', 'olympus-google-fonts' ),
87
+ 'priority' => 1,
88
+ 'panel' => 'olympus_google_fonts',
89
+ 'description' => esc_html__( 'Advanced settings allow fine-grain control and overwrite the basic settings.', 'olympus-google-fonts' ),
90
  ) );
91
 
92
+ $wp_customize->add_setting( 'ogf_site_title_font', array(
93
  'default' => 'default',
94
  'transport' => 'refresh',
95
  ) );
96
 
97
  $wp_customize->add_control( 'site_title_font', array(
98
+ 'label' => esc_html__( 'Site Title Font', 'olympus-google-fonts' ),
99
+ 'section' => 'olympus-google-fonts-advanced',
100
+ 'settings' => 'ogf_site_title_font',
101
+ 'type' => 'select',
102
  'choices' => ogf_font_choices_for_select(),
103
  ) );
104
 
105
+ $wp_customize->add_setting( 'ogf_site_description_font', array(
106
  'default' => 'default',
107
  'transport' => 'refresh',
108
  ) );
109
 
110
  $wp_customize->add_control( 'site_description_font', array(
111
+ 'label' => esc_html__( 'Site Description Font', 'olympus-google-fonts' ),
112
+ 'section' => 'olympus-google-fonts-advanced',
113
+ 'settings' => 'ogf_site_description_font',
114
+ 'type' => 'select',
115
  'choices' => ogf_font_choices_for_select(),
116
  ) );
117
 
118
+ $wp_customize->add_setting( 'ogf_navigation_font', array(
119
  'default' => 'default',
120
  'transport' => 'refresh',
121
  ) );
122
 
123
  $wp_customize->add_control( 'navigation_font', array(
124
+ 'label' => esc_html__( 'Navigation Font', 'olympus-google-fonts' ),
125
+ 'section' => 'olympus-google-fonts-advanced',
126
+ 'settings' => 'ogf_navigation_font',
127
+ 'type' => 'select',
128
  'choices' => ogf_font_choices_for_select(),
129
  ) );
130
 
131
+ $wp_customize->add_setting( 'ogf_post_page_headings_font', array(
132
  'default' => 'default',
133
  'transport' => 'refresh',
134
  ) );
135
 
136
  $wp_customize->add_control( 'post_page_headings_font', array(
137
+ 'label' => esc_html__( 'Post/Page Headings Font', 'olympus-google-fonts' ),
138
+ 'section' => 'olympus-google-fonts-advanced',
139
+ 'settings' => 'ogf_post_page_headings_font',
140
+ 'type' => 'select',
141
  'choices' => ogf_font_choices_for_select(),
142
  ) );
143
 
144
+ $wp_customize->add_setting( 'ogf_post_page_content_font', array(
145
  'default' => 'default',
146
  'transport' => 'refresh',
147
  ) );
148
 
149
  $wp_customize->add_control( 'post_page_content_font', array(
150
+ 'label' => esc_html__( 'Post/Page Content Font', 'olympus-google-fonts' ),
151
+ 'section' => 'olympus-google-fonts-advanced',
152
+ 'settings' => 'ogf_post_page_content_font',
153
+ 'type' => 'select',
154
  'choices' => ogf_font_choices_for_select(),
155
  ) );
156
 
157
+ $wp_customize->add_setting( 'ogf_sidebar_headings_font', array(
158
  'default' => 'default',
159
  'transport' => 'refresh',
160
  ) );
161
 
162
  $wp_customize->add_control( 'sidebar_headings_font', array(
163
+ 'label' => esc_html__( 'Sidebar Headings Font', 'olympus-google-fonts' ),
164
+ 'section' => 'olympus-google-fonts-advanced',
165
+ 'settings' => 'ogf_sidebar_headings_font',
166
+ 'type' => 'select',
167
  'choices' => ogf_font_choices_for_select(),
168
  ) );
169
 
170
+ $wp_customize->add_setting( 'ogf_sidebar_content_font', array(
171
  'default' => 'default',
172
  'transport' => 'refresh',
173
  ) );
174
 
175
  $wp_customize->add_control( 'sidebar_content_font', array(
176
+ 'label' => esc_html__( 'Sidebar Content Font', 'olympus-google-fonts' ),
177
+ 'section' => 'olympus-google-fonts-advanced',
178
+ 'settings' => 'ogf_sidebar_content_font',
179
+ 'type' => 'select',
180
  'choices' => ogf_font_choices_for_select(),
181
  ) );
182
 
183
+ $wp_customize->add_setting( 'ogf_footer_headings_font', array(
184
  'default' => 'default',
185
  'transport' => 'refresh',
186
  ) );
187
 
188
  $wp_customize->add_control( 'footer_headings_font', array(
189
+ 'label' => esc_html__( 'Footer Headings Font', 'olympus-google-fonts' ),
190
+ 'section' => 'olympus-google-fonts-advanced',
191
+ 'settings' => 'ogf_footer_headings_font',
192
+ 'type' => 'select',
193
  'choices' => ogf_font_choices_for_select(),
194
  ) );
195
 
196
+ $wp_customize->add_setting( 'ogf_footer_content_font', array(
197
  'default' => 'default',
198
  'transport' => 'refresh',
199
  ) );
200
 
201
  $wp_customize->add_control( 'footer_content_font', array(
202
+ 'label' => esc_html__( 'Footer Content Font', 'olympus-google-fonts' ),
203
+ 'section' => 'olympus-google-fonts-advanced',
204
+ 'settings' => 'ogf_footer_content_font',
205
+ 'type' => 'select',
206
  'choices' => ogf_font_choices_for_select(),
207
  ) );
208
 
209
+ $wp_customize->add_setting( 'ogf_force_advanced_styles', array(
210
+ 'default' => '',
211
+ 'transport' => 'refresh',
212
  'sanitize_callback' => 'ogf_sanitize_checkbox',
213
  ) );
214
 
215
  $wp_customize->add_control( 'force_advanced_styles', array(
216
+ 'label' => esc_html__( 'Force Advanced Styles?', 'olympus-google-fonts' ),
217
+ 'section' => 'olympus-google-fonts-advanced',
218
+ 'settings' => 'ogf_force_advanced_styles',
219
+ 'type' => 'checkbox',
220
  'description' => esc_html__( 'If your choices are not displaying correctly, check this box.', 'olympus-google-fonts' ),
221
  ) );
222
 
includes/functions.php CHANGED
@@ -45,8 +45,8 @@ function ogf_build_font_stack( $font_id ) {
45
 
46
  $google_fonts = ogf_fonts_array();
47
 
48
- $sans = '"Helvetica Neue", Helvetica, Arial, sans-serif';
49
- $serif = 'Georgia, Times, "Times New Roman", serif';
50
  $monospace = '"Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;';
51
 
52
  if ( array_key_exists( $font_id, $google_fonts ) ) {
45
 
46
  $google_fonts = ogf_fonts_array();
47
 
48
+ $sans = '"Helvetica Neue", Helvetica, Arial, sans-serif';
49
+ $serif = 'Georgia, Times, "Times New Roman", serif';
50
  $monospace = '"Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;';
51
 
52
  if ( array_key_exists( $font_id, $google_fonts ) ) {
olympus-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: Google Fonts for WordPress
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The simplest Google Fonts plugin for WordPress. Add Google Fonts functionality to your WordPress website in minutes without any coding.
8
- * Version: 1.0.8
9
  * Author: Danny Cooper
10
  * Author URI: https://olympusthemes.com/
11
  * Text Domain: olympus-google-fonts
@@ -13,62 +13,11 @@
13
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
14
  * Domain Path: /languages
15
  *
16
- * @package olympus-google-fonts
 
 
17
  */
18
 
19
- /**
20
- * Main Olympus_Google_Fonts Class
21
- */
22
- class Olympus_Google_Fonts {
23
-
24
- /**
25
- * Initialize plugin.
26
- */
27
- public function __construct() {
28
-
29
- $this->includes();
30
-
31
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) );
32
-
33
- }
34
-
35
- /**
36
- * Load plugin files.
37
- */
38
- public function includes() {
39
-
40
- // Required files for building the Google Fonts URL.
41
- require plugin_dir_path( __FILE__ ) . 'includes/functions.php';
42
- require plugin_dir_path( __FILE__ ) . 'includes/class-google-url.php';
43
-
44
- // Required files for the customizer settings.
45
- require plugin_dir_path( __FILE__ ) . 'includes/customizer/settings.php';
46
- require plugin_dir_path( __FILE__ ) . 'includes/customizer/output-css.php';
47
-
48
- }
49
-
50
- /**
51
- * Load plugin textdomain.
52
- */
53
- public function load_textdomain() {
54
-
55
- load_plugin_textdomain( 'olympus-google-fonts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
56
-
57
- }
58
-
59
- /**
60
- * Enqeue the Google Fonts URL.
61
- */
62
- public function enqueue() {
63
-
64
- $url = new OGF_Google_URL();
65
-
66
- if ( $url->has_custom_fonts() ) {
67
- wp_enqueue_style( 'olympus-google-fonts', $url->build() , false );
68
- }
69
-
70
- }
71
-
72
- }
73
 
74
  $gfwp = new Olympus_Google_Fonts();
5
  * Plugin Name: Google Fonts for WordPress
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The simplest Google Fonts plugin for WordPress. Add Google Fonts functionality to your WordPress website in minutes without any coding.
8
+ * Version: 1.1.0
9
  * Author: Danny Cooper
10
  * Author URI: https://olympusthemes.com/
11
  * Text Domain: olympus-google-fonts
13
  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
14
  * Domain Path: /languages
15
  *
16
+ * @package olympus-google-fonts
17
+ * @copyright Copyright (c) 2017, Danny Cooper
18
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
19
  */
20
 
21
+ require plugin_dir_path( __FILE__ ) . 'class-olympus-google-fonts.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  $gfwp = new Olympus_Google_Fonts();
readme.txt CHANGED
@@ -58,6 +58,16 @@ We are 99.99% certain it will, if it doesn't and you have tried the 'Force Style
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
 
 
 
 
 
61
  = 1.0.8 =
62
  *Release Date - Nov 22 2017*
63
 
58
 
59
  == Changelog ==
60
 
61
+ = 1.1.0 =
62
+ *Release Date - Dec 30 2017*
63
+
64
+ * Improve outputting of Google stylesheet
65
+
66
+ = 1.0.9 =
67
+ *Release Date - Dec 3 2017*
68
+
69
+ * Fix navigation font setting
70
+
71
  = 1.0.8 =
72
  *Release Date - Nov 22 2017*
73