Skip to content

Commit e44c171

Browse files
authored
Merge pull request #15 from brainstormforce/typekit-googlefont-url-fix
Version 1.0.10 - Remove Typekit font from the Google URL using astra_google_fonts URL.
2 parents 0ecd619 + aa0d61b commit e44c171

File tree

6 files changed

+40
-11
lines changed

6 files changed

+40
-11
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
**Tags:** custom typekit fonts, theme custom fonts, unlimited typekit custom fonts
55
**Requires at least:** 4.4
66
**Tested up to:** 5.0
7-
**Stable tag:** 1.0.9
7+
**Stable tag:** 1.0.10
88
**License:** GPLv2 or later
99
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -49,6 +49,9 @@ If you're not using any of the supported plugins and theme, you can write the cu
4949

5050
## Changelog ##
5151

52+
### v1.0.10 ###
53+
- Fix: Remove typekit font from the Astra Theme's google fonts URL.
54+
5255
### v1.0.9 ###
5356
- Improvement: Use CSS embed method for enqueueing TypeKit fonts. This should remove the slight delay in displaying the TypeKit fonts on the page,
5457
- Fix: Post URL in the Block Editor goes behind the Editor Top Bar.

classes/class-custom-typekit-fonts-render.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function get_instance() {
6565
public function __construct() {
6666

6767
add_action( 'wp_enqueue_scripts', array( $this, 'typekit_embed_css' ) );
68-
// add Custom Font list into Astra customizer.
68+
// Add Custom Font list into Astra customizer.
6969
add_action( 'astra_customizer_font_list', array( $this, 'add_customizer_font_list' ) );
7070
add_action( 'astra_render_fonts', array( $this, 'render_fonts' ) );
7171
add_filter( 'astra_custom_fonts', array( $this, 'add_typekit_fonts' ) );
@@ -77,6 +77,8 @@ public function __construct() {
7777
add_filter( 'elementor/fonts/additional_fonts', array( $this, 'add_elementor_fonts' ) );
7878

7979
add_action( 'enqueue_block_editor_assets', array( $this, 'typekit_embed_css' ) );
80+
// Astra filter before creating google fonts URL.
81+
add_filter( 'astra_google_fonts', array( $this, 'remove_typekit_font_google_url' ) );
8082
}
8183

8284
/**
@@ -229,6 +231,27 @@ function bb_custom_fonts( $bb_fonts ) {
229231

230232
return array_merge( $bb_fonts, $custom_fonts );
231233
}
234+
235+
/**
236+
* Remove Typekit Font from Google Font URL.
237+
*
238+
* @since 1.1.0
239+
* @param array $fonts font families selected.
240+
*/
241+
function remove_typekit_font_google_url( $fonts ) {
242+
243+
$kit_list = get_option( 'custom-typekit-fonts', array() );
244+
if ( ! empty( $kit_list['custom-typekit-font-details'] ) ) {
245+
foreach ( $kit_list['custom-typekit-font-details'] as $key => $value ) {
246+
$font_key = "'" . $value['family'] . "'" . ',' . $value['fallback'];
247+
if ( array_key_exists( $font_key, $fonts ) ) {
248+
unset( $fonts[ $font_key ] );
249+
}
250+
}
251+
}
252+
253+
return $fonts;
254+
}
232255
}
233256

234257
/**

custom-typekit-fonts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Author: Brainstorm Force
77
* Author URI: http://www.brainstormforce.com
88
* Text Domain: custom-typekit-fonts
9-
* Version: 1.0.9
9+
* Version: 1.0.10
1010
*
1111
* @package Typekit_Custom_Fonts
1212
*/
@@ -25,7 +25,7 @@
2525
define( 'CUSTOM_TYPEKIT_FONTS_BASE', plugin_basename( CUSTOM_TYPEKIT_FONTS_FILE ) );
2626
define( 'CUSTOM_TYPEKIT_FONTS_DIR', plugin_dir_path( CUSTOM_TYPEKIT_FONTS_FILE ) );
2727
define( 'CUSTOM_TYPEKIT_FONTS_URI', plugins_url( '/', CUSTOM_TYPEKIT_FONTS_FILE ) );
28-
define( 'CUSTOM_TYPEKIT_FONTS_VER', '1.0.9' );
28+
define( 'CUSTOM_TYPEKIT_FONTS_VER', '1.0.10' );
2929
/**
3030
* BSF Custom Fonts
3131
*/

languages/custom-typekit-fonts.pot

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Copyright (C) 2018 Brainstorm Force
1+
# Copyright (C) 2019 Brainstorm Force
22
# This file is distributed under the same license as the Custom Typekit Fonts package.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Custom Typekit Fonts 1.0.8\n"
5+
"Project-Id-Version: Custom Typekit Fonts 1.0.10\n"
66
"Report-Msgid-Bugs-To: "
77
"https://wordpress.org/support/plugin/custom-typekit-fonts\n"
8-
"POT-Creation-Date: 2018-12-27 09:11:35+00:00\n"
8+
"POT-Creation-Date: 2019-01-22 02:37:10+00:00\n"
99
"MIME-Version: 1.0\n"
1010
"Content-Type: text/plain; charset=utf-8\n"
1111
"Content-Transfer-Encoding: 8bit\n"
12-
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12+
"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
1515
"Language: en\n"
@@ -39,7 +39,7 @@ msgid "Custom Typekit Fonts settings have been successfully saved."
3939
msgstr ""
4040

4141
#: classes/class-custom-typekit-fonts-admin.php:106
42-
#: classes/class-custom-typekit-fonts-render.php:90
42+
#: classes/class-custom-typekit-fonts-render.php:94
4343
#: templates/custom-typekit-fonts-options.php:11
4444
msgid "Typekit Fonts"
4545
msgstr ""

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "custom-typekit-fonts",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"main": "Gruntfile.js",
55
"author": "YOUR NAME HERE",
66
"devDependencies": {

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://wpastra.com/
44
Tags: custom typekit fonts, theme custom fonts, unlimited typekit custom fonts
55
Requires at least: 4.4
66
Tested up to: 5.0
7-
Stable tag: 1.0.9
7+
Stable tag: 1.0.10
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -49,6 +49,9 @@ If you're not using any of the supported plugins and theme, you can write the cu
4949

5050
== Changelog ==
5151

52+
= v1.0.10 =
53+
- Fix: Remove typekit font from the Astra Theme's google fonts URL.
54+
5255
= v1.0.9 =
5356
- Improvement: Use CSS embed method for enqueueing TypeKit fonts. This should remove the slight delay in displaying the TypeKit fonts on the page,
5457
- Fix: Post URL in the Block Editor goes behind the Editor Top Bar.

0 commit comments

Comments
 (0)