Google Fonts for WordPress - Version 1.0.6

Version Description

Release Date - 14th October 2017

  • Minor code improvements
Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.6

README.md CHANGED
File without changes
includes/class-google-url.php CHANGED
File without changes
includes/customizer/output-css.php CHANGED
@@ -15,9 +15,8 @@ function ogf_output_css() {
15
  <!-- Olympus Google Fonts CSS-->
16
  <style type="text/css">
17
 
18
-
19
  <?php ogf_generate_css( 'body', 'ogf_body_font' ); ?>
20
- <?php ogf_generate_css( 'h1, h2, h3, h4, h5, h6', 'ogf_headings_font' ); ?>
21
  <?php ogf_generate_css( 'button, input, select, textarea', 'ogf_inputs_font' ); ?>
22
 
23
  </style>
@@ -42,8 +41,19 @@ function ogf_generate_css( $selector, $option_name ) {
42
  if ( ! empty( $stack ) && 'default' !== $stack ) {
43
  $return = sprintf('%s { font-family: %s; }',
44
  $selector,
45
- $stack
46
  );
47
  }
48
  echo wp_kses_post( $return );
49
  }
 
 
 
 
 
 
 
 
 
 
 
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' ); ?>
21
 
22
  </style>
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
+ /**
51
+ * Check if the styles should be forced.
52
+ */
53
+ function ogf_is_forced() {
54
+
55
+ if ( '1' === get_theme_mod( 'ogf_force_styles' ) ) {
56
+ return ' !important';
57
+ }
58
+
59
+ }
includes/customizer/settings.php CHANGED
@@ -58,6 +58,20 @@ function ogf_customize_register( $wp_customize ) {
58
  'choices' => ogf_font_choices_for_select(),
59
  ) );
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
  add_action( 'customize_register', 'ogf_customize_register' );
63
 
@@ -78,3 +92,16 @@ function ogf_font_choices_for_select() {
78
  return $fonts;
79
 
80
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  'choices' => ogf_font_choices_for_select(),
59
  ) );
60
 
61
+ $wp_customize->add_setting( 'ogf_force_styles' , array(
62
+ 'default' => '',
63
+ 'transport' => 'refresh',
64
+ 'sanitize_callback' => 'ogf_sanitize_checkbox',
65
+ ) );
66
+
67
+ $wp_customize->add_control( 'force_styles', array(
68
+ 'label' => esc_html__( 'Force Styles?', 'olympus-google-fonts' ),
69
+ 'section' => 'olympus-google-fonts',
70
+ 'settings' => 'ogf_force_styles',
71
+ 'type' => 'checkbox',
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
 
92
  return $fonts;
93
 
94
  }
95
+
96
+ /**
97
+ * Sanitize the checbox value.
98
+ *
99
+ * @param int $input the input to sanitize.
100
+ * @return int 1 if checked, 0 if not.
101
+ */
102
+ function ogf_sanitize_checkbox( $input ) {
103
+ if ( true === $input || '1' === $input ) {
104
+ return '1';
105
+ }
106
+ return '0';
107
+ }
includes/fonts.json CHANGED
File without changes
includes/functions.php CHANGED
@@ -1,4 +1,12 @@
1
  <?php
 
 
 
 
 
 
 
 
2
  if ( ! function_exists( 'ogf_fonts_array' ) ) :
3
  /**
4
  * Return an array of all available Google Fonts.
@@ -41,7 +49,7 @@ function ogf_build_font_stack( $font_id ) {
41
  $serif = 'Georgia, Times, "Times New Roman", serif';
42
  $monospace = '"Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;';
43
 
44
- if( array_key_exists( $font_id, $google_fonts ) ) {
45
 
46
  if ( 'monospace' === $google_fonts[ $font_id ]['category'] ) {
47
  $stack = $monospace;
1
  <?php
2
+ /**
3
+ * Helper functions
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
  if ( ! function_exists( 'ogf_fonts_array' ) ) :
11
  /**
12
  * Return an array of all available Google Fonts.
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 ) ) {
53
 
54
  if ( 'monospace' === $google_fonts[ $font_id ]['category'] ) {
55
  $stack = $monospace;
languages/olympus-google-fonts.pot CHANGED
File without changes
olympus-google-fonts.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * Google Fonts WordPress
4
  *
5
- * Plugin Name: Olympus Google Fonts
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
- * Description: Add Google Fonts functionality to your WordPress website in minutes without any coding.
8
- * Version: 1.0.3
9
  * Author: Danny Cooper
10
  * Author URI: https://olympusthemes.com/
11
  * Text Domain: olympus-google-fonts
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 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
readme.txt CHANGED
@@ -1,15 +1,15 @@
1
- === Olympus Google Fonts ===
2
  Contributors: DannyCooper
3
- Tags: google fonts, custom fonts, fonts, live preview
4
  Requires at least: 4.0
5
- Tested up to: 4.8.2
6
  License: GPLv2 or later
7
  Stable tag: trunk
8
 
9
  Quickly and easily customize your website using Google Fonts.
10
 
11
  == Description ==
12
- The Google Fonts library currently contains 846 unique fonts. This plugin allows you to easily use any of them on your website.
13
 
14
  You're not stuck with one font for the entire website, you can easily choose one font for headings and another for your content.
15
 
@@ -19,8 +19,16 @@ Once you've found a combination you love, you can press save and make the change
19
 
20
  The full Google Fonts library can be found here - [Google Fonts](https://fonts.google.com)
21
 
 
 
 
 
 
 
 
 
22
  = Bugs =
23
- If you find an issue, let us know [here](https://github.com/DannyCooper/olympus-google-fonts/issues)!
24
 
25
 
26
  = Contributions =
@@ -34,16 +42,32 @@ There are various ways you can contribute:
34
  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)
35
 
36
  == Installation ==
37
- Upload 'Olympus Google Fonts', activate it, and you're done!
38
 
39
  Navigate to wp-admin -> Appearance -> Customize and you will see a new tab named 'Google Fonts'
40
 
 
 
 
 
 
 
41
  == Screenshots ==
42
 
43
- 1. Customizer Settings - Olympus Google Fonts
44
 
45
  == Changelog ==
46
 
 
 
 
 
 
 
 
 
 
 
47
  = 1.0.3 =
48
  *Release Date - 14th October 2017*
49
 
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
7
  Stable tag: trunk
8
 
9
  Quickly and easily customize your website using Google Fonts.
10
 
11
  == Description ==
12
+ The Google Fonts library currently contains 846 unique fonts. This plugin allows you to easily use any of them on your WordPress website.
13
 
14
  You're not stuck with one font for the entire website, you can easily choose one font for headings and another for your content.
15
 
19
 
20
  The full Google Fonts library can be found here - [Google Fonts](https://fonts.google.com)
21
 
22
+ The Google Fonts for WordPress plugin will work with all WordPress themes and has been specifically tested with the following:
23
+
24
+ * All OlympusThemes
25
+ * All StudioPress and Genesis Themes
26
+ * TwentyFifteen
27
+ * TwentySixteen
28
+ * TwentySeventeen
29
+
30
  = Bugs =
31
+ If you find an issue with Google Fonts for WordPress, let us know [here](https://github.com/DannyCooper/olympus-google-fonts/issues)!
32
 
33
 
34
  = Contributions =
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 ==
45
+ Upload 'Google Fonts for WordPress', activate it, and you're done!
46
 
47
  Navigate to wp-admin -> Appearance -> Customize and you will see a new tab named 'Google Fonts'
48
 
49
+ == Frequently Asked Questions ==
50
+
51
+ = Will my theme work with Google Fonts for WordPress? =
52
+
53
+ We are 99.99% certain it will, if it doesn't and you have tried the 'Force Styles' option then please create a [support ticket](https://wordpress.org/support/plugin/olympus-google-fonts).
54
+
55
  == Screenshots ==
56
 
57
+ 1. Customizer Settings - Google Fonts for WordPress
58
 
59
  == Changelog ==
60
 
61
+ = 1.0.6 =
62
+ *Release Date - 14th October 2017*
63
+
64
+ * Minor code improvements
65
+
66
+ = 1.0.5 =
67
+ *Release Date - 14th October 2017*
68
+
69
+ * Add force styles option
70
+
71
  = 1.0.3 =
72
  *Release Date - 14th October 2017*
73