Google Fonts for WordPress - Version 1.0.7

Version Description

Release Date - 19th Nov 2017

  • Add advanced settings
Download this release

Release Info

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

Code changes from version 1.0.6 to 1.0.7

includes/customizer/output-css.php CHANGED
@@ -19,6 +19,18 @@ function ogf_output_css() {
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' ); ?>
21
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  </style>
23
  <!--/Customizer CSS-->
24
  <?php
@@ -36,15 +48,19 @@ add_action( 'wp_head' , 'ogf_output_css' );
36
  function ogf_generate_css( $selector, $option_name ) {
37
  $return = '';
38
 
39
- $stack = ogf_build_font_stack( get_theme_mod( $option_name ) );
 
 
 
 
 
 
 
 
 
 
40
 
41
- if ( ! empty( $stack ) && 'default' !== $stack ) {
42
- $return = sprintf('%s { font-family: %s; }',
43
- $selector,
44
- $stack . ogf_is_forced()
45
- );
46
  }
47
- echo wp_kses_post( $return );
48
  }
49
 
50
  /**
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' ); ?>
21
 
22
+ /* Advanced Settings */
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
48
  function ogf_generate_css( $selector, $option_name ) {
49
  $return = '';
50
 
51
+ if ( ! empty( get_theme_mod( $option_name ) ) ) {
52
+
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
+ );
60
+ }
61
+ echo wp_kses_post( $return );
62
 
 
 
 
 
 
63
  }
 
64
  }
65
 
66
  /**
includes/customizer/settings.php CHANGED
@@ -14,9 +14,18 @@
14
  */
15
  function ogf_customize_register( $wp_customize ) {
16
 
 
 
 
 
 
 
 
 
17
  $wp_customize->add_section( 'olympus-google-fonts' , array(
18
- 'title' => esc_html__( 'Google Fonts', 'olympus-google-fonts' ),
19
  'priority' => 1,
 
20
  ) );
21
 
22
  $wp_customize->add_setting( 'ogf_body_font' , array(
@@ -72,6 +81,146 @@ function ogf_customize_register( $wp_customize ) {
72
  'description' => esc_html__( 'If your choices are not displaying correctly, check this box.', 'olympus-google-fonts' ),
73
  ) );
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
  add_action( 'customize_register', 'ogf_customize_register' );
77
 
14
  */
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(
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
+
224
  }
225
  add_action( 'customize_register', 'ogf_customize_register' );
226
 
includes/functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Helper functions
4
  *
5
  * @package olympus-google-fonts
6
  * @copyright Copyright (c) 2017, Danny Cooper
1
  <?php
2
  /**
3
+ * Helper functions.
4
  *
5
  * @package olympus-google-fonts
6
  * @copyright Copyright (c) 2017, Danny Cooper
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.5
9
  * Author: Danny Cooper
10
  * Author URI: https://olympusthemes.com/
11
  * Text Domain: olympus-google-fonts
@@ -49,8 +49,6 @@ class Olympus_Google_Fonts {
49
 
50
  /**
51
  * Load plugin textdomain.
52
- *
53
- * @since 1.0.0
54
  */
55
  public function load_textdomain() {
56
 
@@ -60,8 +58,6 @@ class Olympus_Google_Fonts {
60
 
61
  /**
62
  * Enqeue the Google Fonts URL.
63
- *
64
- * @since 1.0.0
65
  */
66
  public function enqueue() {
67
 
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.7
9
  * Author: Danny Cooper
10
  * Author URI: https://olympusthemes.com/
11
  * Text Domain: olympus-google-fonts
49
 
50
  /**
51
  * Load plugin textdomain.
 
 
52
  */
53
  public function load_textdomain() {
54
 
58
 
59
  /**
60
  * Enqeue the Google Fonts URL.
 
 
61
  */
62
  public function enqueue() {
63
 
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === Google Fonts for WordPress ===
2
  Contributors: DannyCooper
3
- Tags: google fonts, google fonts for wordpress, fonts, live preview, custom fonts, customizer, studiopress, genesis
4
  Requires at least: 4.0
5
  Tested up to: 4.9
6
  License: GPLv2 or later
@@ -32,13 +32,13 @@ If you find an issue with Google Fonts for WordPress, let us know [here](https:/
32
 
33
 
34
  = Contributions =
35
- Anyone is welcome to contribute to the 'Olympus Google Fonts' plugin.
36
 
37
  There are various ways you can contribute:
38
 
39
  1. Raise an [Issue](https://github.com/DannyCooper/olympus-google-fonts/issues) on GitHub
40
  2. Send us a Pull Request with your bug fixes and/or new features
41
- 3. Translate the Olympus Google Fonts plugin into [different languages](https://translate.wordpress.org/projects/wp-plugins/olympus-google-fonts/)
42
  4. Provide feedback and suggestions on [enhancements](https://github.com/DannyCooper/olympus-google-fonts/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open)
43
 
44
  == Installation ==
@@ -58,8 +58,13 @@ 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.6 =
62
- *Release Date - 14th October 2017*
63
 
64
  * Minor code improvements
65
 
1
  === Google Fonts for WordPress ===
2
  Contributors: DannyCooper
3
+ Tags: google fonts, google fonts for wordpress, fonts, live preview, custom fonts
4
  Requires at least: 4.0
5
  Tested up to: 4.9
6
  License: GPLv2 or later
32
 
33
 
34
  = Contributions =
35
+ Anyone is welcome to contribute to the 'Google Fonts for WordPress' plugin.
36
 
37
  There are various ways you can contribute:
38
 
39
  1. Raise an [Issue](https://github.com/DannyCooper/olympus-google-fonts/issues) on GitHub
40
  2. Send us a Pull Request with your bug fixes and/or new features
41
+ 3. Translate the Google Fonts for WordPress plugin into [different languages](https://translate.wordpress.org/projects/wp-plugins/olympus-google-fonts/)
42
  4. Provide feedback and suggestions on [enhancements](https://github.com/DannyCooper/olympus-google-fonts/issues?direction=desc&labels=Enhancement&page=1&sort=created&state=open)
43
 
44
  == Installation ==
58
 
59
  == Changelog ==
60
 
61
+ = 1.0.7 =
62
+ *Release Date - 19th Nov 2017*
63
+
64
+ * Add advanced settings
65
+
66
  = 1.0.6 =
67
+ *Release Date - 15th Nov 2017*
68
 
69
  * Minor code improvements
70