Version Description
- Add support for Typekit's new CSS embed method.
- Add support for Typekit's improved Advanced Javascript embed code.
- Simplified settings screen (just enter your Kit ID rather than your full embed code).
- WordPress 4.9 compatibility.
Download this release
Release Info
Developer | jamescollins |
Plugin | Typekit Fonts for WordPress |
Version | 1.9.0 |
Comparing to | |
See all releases |
Code changes from version 1.8.4 to 1.9.0
- languages/typekit-fonts-for-wordpress.pot +70 -54
- readme.txt +15 -5
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- typekit-admin.php +24 -13
- typekit.php +63 -39
languages/typekit-fonts-for-wordpress.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the Typekit Fonts for WordPress package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Typekit Fonts for WordPress 1.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/typekit-fonts-for-wordpress\n"
|
7 |
-
"POT-Creation-Date: 2017-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -20,179 +20,195 @@ msgstr ""
|
|
20 |
msgid "Settings"
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: typekit-admin.php:
|
24 |
msgid " Please <a href=\"%s\">click here for instructions</a> on how to obtain your Typekit embed code."
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: typekit-admin.php:
|
28 |
-
msgid "Invalid Typekit
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: typekit-admin.php:
|
32 |
-
msgid "You must enter your Typekit
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: typekit-admin.php:
|
36 |
-
msgid "Your Typekit
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: typekit-admin.php:
|
40 |
msgid "Settings saved."
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: typekit-admin.php:
|
44 |
msgid "Typekit Fonts for WordPress Settings"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: typekit-admin.php:
|
48 |
msgid "Typekit offer a service that allows you to select from a range of hundreds of high quality fonts for your WordPress website. The fonts are applied using the font-face standard, so they are standards compliant, fully licensed and accessible."
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: typekit-admin.php:
|
52 |
msgid "To use this plugin you need to sign up with Typekit, and then configure the following options."
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: typekit-admin.php:
|
56 |
msgid "Register with Typekit"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: typekit-admin.php:
|
60 |
-
msgid "Go to <a href=\"%s\" target=\"blank\">typekit.com</a> and register for an account"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: typekit-admin.php:
|
64 |
-
msgid "Choose a few fonts to add to your account and Publish them"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: typekit-admin.php:
|
68 |
-
msgid "Go to the Kit Editor
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: typekit-admin.php:
|
72 |
msgid "Plugin Configuration"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: typekit-admin.php:
|
76 |
-
msgid "Enter
|
|
|
|
|
|
|
|
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: typekit-admin.php:
|
80 |
-
msgid "
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: typekit-admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
msgid "You can add selectors using the Typekit Kit Editor. Alternatively you can define your own CSS rules in your own style sheet or using the Custom CSS Rules field below (technical note: these CSS rules will be embedded in the header of each page). Look at the advanced examples shown in the Typekit editor for ideas."
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: typekit-admin.php:
|
88 |
msgid "Custom CSS Rules:"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: typekit-admin.php:
|
92 |
msgid "Click here for help on CSS"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: typekit-admin.php:
|
96 |
msgid "Save Settings"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: typekit-admin.php:
|
100 |
msgid "Help"
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: typekit-admin.php:
|
104 |
msgid "Fonts not showing?"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: typekit-admin.php:
|
108 |
msgid "Have you created your Typekit account, added fonts to it and <strong>pressed Publish</strong>? Fonts aren't available until they are published."
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: typekit-admin.php:
|
112 |
msgid "Have you <strong>waited a few minutes</strong> to allow Typekit time to send your fonts out around the world? Grab a cup of coffee and try again soon."
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: typekit-admin.php:
|
116 |
msgid "Have you <strong>added CSS rules</strong> to display your fonts? If in doubt, just try the H2 rule shown in the example and see if that works for you."
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: typekit-admin.php:
|
120 |
msgid "CSS"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: typekit-admin.php:
|
124 |
msgid "You can use CSS selectors to apply your new typekit fonts. The settings for this plugin allow you to add new CSS rules to your website to activate Typekit fonts. If you are using fonts for more than just a few elements, you may find it easier to manage this way. And using your own CSS rules is a good way to access different font weights."
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: typekit-admin.php:
|
128 |
msgid "There are many options for using CSS, but here are a few common scenarios. Note: we've used proxima-nova for our examples, you'll need to change proxima-nova to the name of your chosen font from Typekit - your added font names will be visible in the Kit Editor."
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: typekit-admin.php:
|
132 |
msgid "Headings"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: typekit-admin.php:
|
136 |
msgid "If you want your Typekit fonts to be used for H2 headings, add a rule like this to your CSS Rules field:"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: typekit-admin.php:
|
140 |
msgid "(and you can add similar rules if you want to target other headings such as H3)"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: typekit-admin.php:
|
144 |
msgid "Sidebar Headings"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: typekit-admin.php:
|
148 |
msgid "If you want your Typekit fonts to be used for sidebar H2 headings, add a rule like this to your CSS Rules field:"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: typekit-admin.php:
|
152 |
msgid "Font Weights"
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: typekit-admin.php:
|
156 |
msgid "If your Kit contains more than one weight and/or style for a particular font, you need to use numeric <code class=\"inline\">font-weight</code> values in your CSS rules to map to a font's weights."
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: typekit-admin.php:
|
160 |
msgid "Typekit fonts have been assigned values from 100 to 900 based on information from the font's designer. Web browsers also do some guessing as to which weight it should display if the specific value isn't present. Say your font has 100, 300 and 900. If you set your text with <code class=\"inline\">font-weight: 400</code>, it will choose the most appropriate (300 in this case).<br />Note: A <code class=\"inline\">font-weight</code> value of 400 corresponds to <code class=\"inline\">font-weight: normal;</code>"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: typekit-admin.php:
|
164 |
msgid "See <a href=\"%s\">this help article</a> for more details."
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: typekit-admin.php:
|
168 |
msgid "Advanced targetting of fonts with CSS selectors"
|
169 |
msgstr ""
|
170 |
|
171 |
-
#: typekit-admin.php:
|
172 |
msgid "You can target your fonts to specific parts of your website if you know a bit more about your current WordPress theme and where the font family is specified. All WordPress themes have a style.css file, and if you know how to check that you should be able to see the selectors in use. Or you can install Chris Pederick's Web Developer Toolbar for Firefox and use the CSS, View CSS option to see all the CSS rules in use for your theme. When you find the selectors that are used for font-family, you can create a rule just for that selector to override that rule."
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: typekit-admin.php:
|
176 |
msgid "For example, if your theme has this CSS rule:"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: typekit-admin.php:
|
180 |
msgid "you could create this rule to apply your new font to the body of your website:"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: typekit-admin.php:
|
184 |
msgid "Where to go to get help"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: typekit-admin.php:
|
188 |
msgid "<a href=\"%s\" target=\"_blank\">Typekit Support</a>"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: typekit-admin.php:
|
192 |
msgid "<a href=\"%s\" target=\"_blank\">Sitepoint CSS Forums</a>"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: typekit-admin.php:
|
196 |
msgid "<a href=\"%s\" target=\"_blank\">W3Schools CSS Help</a>"
|
197 |
msgstr ""
|
198 |
#. Plugin Name of the plugin/theme
|
2 |
# This file is distributed under the same license as the Typekit Fonts for WordPress package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Typekit Fonts for WordPress 1.9.0\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/typekit-fonts-for-wordpress\n"
|
7 |
+
"POT-Creation-Date: 2017-12-05 08:19:43+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
20 |
msgid "Settings"
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: typekit-admin.php:77
|
24 |
msgid " Please <a href=\"%s\">click here for instructions</a> on how to obtain your Typekit embed code."
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: typekit-admin.php:80
|
28 |
+
msgid "Invalid Typekit Kit ID. %s"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: typekit-admin.php:83
|
32 |
+
msgid "You must enter your Typekit Kit ID. %s"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: typekit-admin.php:96
|
36 |
+
msgid "Your Typekit Kit ID may be incorrect because <a href=\"%1$s\" target=\"_blank\">%1$s</a> does not exist. Please verify that your Typekit Kit ID correct. If you have just published your kit, please try again in a few minutes."
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: typekit-admin.php:107
|
40 |
msgid "Settings saved."
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: typekit-admin.php:113
|
44 |
msgid "Typekit Fonts for WordPress Settings"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: typekit-admin.php:114
|
48 |
msgid "Typekit offer a service that allows you to select from a range of hundreds of high quality fonts for your WordPress website. The fonts are applied using the font-face standard, so they are standards compliant, fully licensed and accessible."
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: typekit-admin.php:115
|
52 |
msgid "To use this plugin you need to sign up with Typekit, and then configure the following options."
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: typekit-admin.php:116
|
56 |
msgid "Register with Typekit"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: typekit-admin.php:118
|
60 |
+
msgid "Go to <a href=\"%s\" target=\"blank\">typekit.com</a> and register for an account."
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: typekit-admin.php:119
|
64 |
+
msgid "Choose a few fonts to add to your account and Publish them."
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: typekit-admin.php:120
|
68 |
+
msgid "Go to the Kit Editor (link at the top right of the screen) then click on the Embed Code option."
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: typekit-admin.php:122
|
72 |
msgid "Plugin Configuration"
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: typekit-admin.php:124
|
76 |
+
msgid "Enter your Typekit Kit ID (shown at the bottom of the Embed Code screen)."
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: typekit-admin.php:125
|
80 |
+
msgid "Typekit Kit ID:"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: typekit-admin.php:127
|
84 |
+
msgid "Choose your Preferred Embed Method."
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: typekit-admin.php:128
|
88 |
+
msgid "Embed Method:"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: typekit-admin.php:130
|
92 |
+
msgid "CSS Link (Simplest)"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: typekit-admin.php:131
|
96 |
+
msgid "Javascript (Advanced)"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: typekit-admin.php:135
|
100 |
msgid "You can add selectors using the Typekit Kit Editor. Alternatively you can define your own CSS rules in your own style sheet or using the Custom CSS Rules field below (technical note: these CSS rules will be embedded in the header of each page). Look at the advanced examples shown in the Typekit editor for ideas."
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: typekit-admin.php:136
|
104 |
msgid "Custom CSS Rules:"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: typekit-admin.php:137
|
108 |
msgid "Click here for help on CSS"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: typekit-admin.php:142
|
112 |
msgid "Save Settings"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: typekit-admin.php:144
|
116 |
msgid "Help"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: typekit-admin.php:145
|
120 |
msgid "Fonts not showing?"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: typekit-admin.php:147
|
124 |
msgid "Have you created your Typekit account, added fonts to it and <strong>pressed Publish</strong>? Fonts aren't available until they are published."
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: typekit-admin.php:148
|
128 |
msgid "Have you <strong>waited a few minutes</strong> to allow Typekit time to send your fonts out around the world? Grab a cup of coffee and try again soon."
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: typekit-admin.php:149
|
132 |
msgid "Have you <strong>added CSS rules</strong> to display your fonts? If in doubt, just try the H2 rule shown in the example and see if that works for you."
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: typekit-admin.php:151
|
136 |
msgid "CSS"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: typekit-admin.php:152
|
140 |
msgid "You can use CSS selectors to apply your new typekit fonts. The settings for this plugin allow you to add new CSS rules to your website to activate Typekit fonts. If you are using fonts for more than just a few elements, you may find it easier to manage this way. And using your own CSS rules is a good way to access different font weights."
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: typekit-admin.php:153
|
144 |
msgid "There are many options for using CSS, but here are a few common scenarios. Note: we've used proxima-nova for our examples, you'll need to change proxima-nova to the name of your chosen font from Typekit - your added font names will be visible in the Kit Editor."
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: typekit-admin.php:154
|
148 |
msgid "Headings"
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: typekit-admin.php:156
|
152 |
msgid "If you want your Typekit fonts to be used for H2 headings, add a rule like this to your CSS Rules field:"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: typekit-admin.php:158
|
156 |
msgid "(and you can add similar rules if you want to target other headings such as H3)"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: typekit-admin.php:160
|
160 |
msgid "Sidebar Headings"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: typekit-admin.php:162
|
164 |
msgid "If you want your Typekit fonts to be used for sidebar H2 headings, add a rule like this to your CSS Rules field:"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: typekit-admin.php:165
|
168 |
msgid "Font Weights"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: typekit-admin.php:166
|
172 |
msgid "If your Kit contains more than one weight and/or style for a particular font, you need to use numeric <code class=\"inline\">font-weight</code> values in your CSS rules to map to a font's weights."
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: typekit-admin.php:167
|
176 |
msgid "Typekit fonts have been assigned values from 100 to 900 based on information from the font's designer. Web browsers also do some guessing as to which weight it should display if the specific value isn't present. Say your font has 100, 300 and 900. If you set your text with <code class=\"inline\">font-weight: 400</code>, it will choose the most appropriate (300 in this case).<br />Note: A <code class=\"inline\">font-weight</code> value of 400 corresponds to <code class=\"inline\">font-weight: normal;</code>"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: typekit-admin.php:168
|
180 |
msgid "See <a href=\"%s\">this help article</a> for more details."
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: typekit-admin.php:169
|
184 |
msgid "Advanced targetting of fonts with CSS selectors"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: typekit-admin.php:171
|
188 |
msgid "You can target your fonts to specific parts of your website if you know a bit more about your current WordPress theme and where the font family is specified. All WordPress themes have a style.css file, and if you know how to check that you should be able to see the selectors in use. Or you can install Chris Pederick's Web Developer Toolbar for Firefox and use the CSS, View CSS option to see all the CSS rules in use for your theme. When you find the selectors that are used for font-family, you can create a rule just for that selector to override that rule."
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: typekit-admin.php:172
|
192 |
msgid "For example, if your theme has this CSS rule:"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: typekit-admin.php:174
|
196 |
msgid "you could create this rule to apply your new font to the body of your website:"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: typekit-admin.php:177
|
200 |
msgid "Where to go to get help"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: typekit-admin.php:179
|
204 |
msgid "<a href=\"%s\" target=\"_blank\">Typekit Support</a>"
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: typekit-admin.php:180
|
208 |
msgid "<a href=\"%s\" target=\"_blank\">Sitepoint CSS Forums</a>"
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: typekit-admin.php:181
|
212 |
msgid "<a href=\"%s\" target=\"_blank\">W3Schools CSS Help</a>"
|
213 |
msgstr ""
|
214 |
#. Plugin Name of the plugin/theme
|
readme.txt
CHANGED
@@ -3,8 +3,9 @@ Contributors: jamescollins, glenn-om4
|
|
3 |
Donate link: https://om4.com.au/plugins/#donate
|
4 |
Tags: typekit, fonts, font, design, wp, multisite, wpmu, css, snippet
|
5 |
Requires at least: 4.2
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
|
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -20,7 +21,7 @@ To use this plugin you need to sign up with Typekit, install this plugin and the
|
|
20 |
|
21 |
Detailed instructions are available on the plugin's settings page.
|
22 |
|
23 |
-
This plugin by default uses [Typekit's
|
24 |
|
25 |
Compatible with WordPress Multisite.
|
26 |
|
@@ -38,7 +39,7 @@ Installation of this plugin is simple:
|
|
38 |
|
39 |
1. Download the plugin files and copy to your Plugins directory.
|
40 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
41 |
-
1. Go to the WordPress Dashboard, and use "Settings", "Typekit Fonts" to enter
|
42 |
1. If you want to setup some CSS selectors like the examples shown in the Advanced link, enter your CSS rules in the plugin settings as well.
|
43 |
|
44 |
== Frequently Asked Questions ==
|
@@ -53,7 +54,7 @@ Yes, see the plugin's description for more information.
|
|
53 |
|
54 |
= Which web browser(s) does Typekit support? =
|
55 |
|
56 |
-
Please see [this page](
|
57 |
|
58 |
== Screenshots ==
|
59 |
1. Settings/configuration page
|
@@ -61,6 +62,12 @@ Please see [this page](http://help.typekit.com/customer/portal/articles/6786-bro
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
= 1.8.4 =
|
65 |
* Add support for Typekit's synchronous tracking code by setting async to false. Useful for avoiding FOUT.
|
66 |
* WordPress 4.8 compatibility.
|
@@ -139,6 +146,9 @@ Please see [this page](http://help.typekit.com/customer/portal/articles/6786-bro
|
|
139 |
|
140 |
== Upgrade Notice ==
|
141 |
|
|
|
|
|
|
|
142 |
= 1.8 =
|
143 |
* Support for translate.wordpress.org language packs.
|
144 |
* WordPress 4.3 (and 4.4) compatibility.
|
3 |
Donate link: https://om4.com.au/plugins/#donate
|
4 |
Tags: typekit, fonts, font, design, wp, multisite, wpmu, css, snippet
|
5 |
Requires at least: 4.2
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 1.9.0
|
8 |
+
Requires PHP: 5.2.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
21 |
|
22 |
Detailed instructions are available on the plugin's settings page.
|
23 |
|
24 |
+
This plugin by default uses [Typekit's CSS embed code](https://blog.typekit.com/2017/11/16/new-on-typekit-load-web-fonts-with-css/). However if you prefer, you can use the asynchronous Javascript embed.
|
25 |
|
26 |
Compatible with WordPress Multisite.
|
27 |
|
39 |
|
40 |
1. Download the plugin files and copy to your Plugins directory.
|
41 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
42 |
+
1. Go to the WordPress Dashboard, and use "Settings", "Typekit Fonts" to enter your kit ID and embed method.
|
43 |
1. If you want to setup some CSS selectors like the examples shown in the Advanced link, enter your CSS rules in the plugin settings as well.
|
44 |
|
45 |
== Frequently Asked Questions ==
|
54 |
|
55 |
= Which web browser(s) does Typekit support? =
|
56 |
|
57 |
+
Please see [this page](https://helpx.adobe.com/typekit/using/browser-os-support.html) for information on [Typekit web browser support](https://helpx.adobe.com/typekit/using/browser-os-support.html).
|
58 |
|
59 |
== Screenshots ==
|
60 |
1. Settings/configuration page
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 1.9.0 =
|
66 |
+
* Add support for Typekit's new CSS embed method.
|
67 |
+
* Add support for Typekit's improved Advanced Javascript embed code.
|
68 |
+
* Simplified settings screen (just enter your Kit ID rather than your full embed code).
|
69 |
+
* WordPress 4.9 compatibility.
|
70 |
+
|
71 |
= 1.8.4 =
|
72 |
* Add support for Typekit's synchronous tracking code by setting async to false. Useful for avoiding FOUT.
|
73 |
* WordPress 4.8 compatibility.
|
146 |
|
147 |
== Upgrade Notice ==
|
148 |
|
149 |
+
= 1.9.0 =
|
150 |
+
* Simplified settings screen, add support for Typekit's new CSS embed method.
|
151 |
+
|
152 |
= 1.8 =
|
153 |
* Support for translate.wordpress.org language packs.
|
154 |
* WordPress 4.3 (and 4.4) compatibility.
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
typekit-admin.php
CHANGED
@@ -62,9 +62,12 @@ class OM4_Typekit_Admin {
|
|
62 |
<?php
|
63 |
if (isset($_POST['submit']) && check_admin_referer('typekit-fonts-for-wordpress-save-settings') && current_user_can('manage_options')) {
|
64 |
// settings page has been submitted
|
65 |
-
|
66 |
-
if (isset($_POST['
|
67 |
-
|
|
|
|
|
|
|
68 |
$id = $this->typekitInstance->GetAccountID();
|
69 |
if ($id == '') {
|
70 |
// embed code is empty
|
@@ -72,12 +75,12 @@ class OM4_Typekit_Admin {
|
|
72 |
<div id="error" class="error"><p>
|
73 |
<?php
|
74 |
$instructions = sprintf( __(' Please <a href="%s">click here for instructions</a> on how to obtain your Typekit embed code.', 'typekit-fonts-for-wordpress'), '#getembedcode');
|
75 |
-
if (strlen($_POST['
|
76 |
// an embed code has been submitted, but was rejected
|
77 |
-
printf(__('Invalid Typekit
|
78 |
} else {
|
79 |
-
// no
|
80 |
-
printf(__('You must enter your Typekit
|
81 |
}
|
82 |
?>
|
83 |
</p></div>
|
@@ -90,7 +93,7 @@ class OM4_Typekit_Admin {
|
|
90 |
if ( 404 == wp_remote_retrieve_response_code( $response ) ) {
|
91 |
?>
|
92 |
<div id="error" class="error"><p>
|
93 |
-
<?php printf( __( 'Your Typekit
|
94 |
</p></div>
|
95 |
<?php
|
96 |
}
|
@@ -112,15 +115,23 @@ class OM4_Typekit_Admin {
|
|
112 |
<p><?php _e('To use this plugin you need to sign up with Typekit, and then configure the following options.', 'typekit-fonts-for-wordpress'); ?></p>
|
113 |
<h3><?php _e('Register with Typekit', 'typekit-fonts-for-wordpress'); ?></h3>
|
114 |
<ol>
|
115 |
-
<li><?php printf( __('Go to <a href="%s" target="blank">typekit.com</a> and register for an account', 'typekit-fonts-for-wordpress'), 'https://typekit.com/'); ?></li>
|
116 |
-
<li><?php _e('Choose a few fonts to add to your account and Publish them', 'typekit-fonts-for-wordpress'); ?></li>
|
117 |
-
<li id="getembedcode"><?php _e('Go to the Kit Editor
|
118 |
</ol>
|
119 |
<h3><?php _e('Plugin Configuration', 'typekit-fonts-for-wordpress'); ?></h3>
|
120 |
<ol start="4">
|
121 |
-
<li><?php _e('Enter
|
122 |
-
<p class="option"><label for="
|
123 |
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
<li><?php _e('You can add selectors using the Typekit Kit Editor. Alternatively you can define your own CSS rules in your own style sheet or using the Custom CSS Rules field below (technical note: these CSS rules will be embedded in the header of each page). Look at the advanced examples shown in the Typekit editor for ideas.', 'typekit-fonts-for-wordpress'); ?>
|
125 |
<p class="option"><label for="css"><?php _e('Custom CSS Rules:', 'typekit-fonts-for-wordpress'); ?></label> <textarea name="css" rows="10" cols="80"><?php echo esc_textarea( $this->typekitInstance->GetCSSRules() ); ?></textarea><br />
|
126 |
<a href="#help-css"><?php _e('Click here for help on CSS', 'typekit-fonts-for-wordpress'); ?></a>
|
62 |
<?php
|
63 |
if (isset($_POST['submit']) && check_admin_referer('typekit-fonts-for-wordpress-save-settings') && current_user_can('manage_options')) {
|
64 |
// settings page has been submitted
|
65 |
+
|
66 |
+
if ( isset( $_POST['kitid'] ) && isset( $_POST['method'] ) ) {
|
67 |
+
|
68 |
+
$this->typekitInstance->ParseKitID(stripslashes($_POST['kitid']));
|
69 |
+
$this->typekitInstance->ParseEmbedMethod(stripslashes($_POST['method']));
|
70 |
+
|
71 |
$id = $this->typekitInstance->GetAccountID();
|
72 |
if ($id == '') {
|
73 |
// embed code is empty
|
75 |
<div id="error" class="error"><p>
|
76 |
<?php
|
77 |
$instructions = sprintf( __(' Please <a href="%s">click here for instructions</a> on how to obtain your Typekit embed code.', 'typekit-fonts-for-wordpress'), '#getembedcode');
|
78 |
+
if (strlen($_POST['kitid'])) {
|
79 |
// an embed code has been submitted, but was rejected
|
80 |
+
printf(__('Invalid Typekit Kit ID. %s', 'typekit-fonts-for-wordpress'), $instructions);
|
81 |
} else {
|
82 |
+
// no kit ID was submitted
|
83 |
+
printf(__('You must enter your Typekit Kit ID. %s', 'typekit-fonts-for-wordpress'), $instructions);
|
84 |
}
|
85 |
?>
|
86 |
</p></div>
|
93 |
if ( 404 == wp_remote_retrieve_response_code( $response ) ) {
|
94 |
?>
|
95 |
<div id="error" class="error"><p>
|
96 |
+
<?php printf( __( 'Your Typekit Kit ID may be incorrect because <a href="%1$s" target="_blank">%1$s</a> does not exist. Please verify that your Typekit Kit ID correct. If you have just published your kit, please try again in a few minutes.', 'typekit-fonts-for-wordpress'), esc_url( $url ) ); ?>
|
97 |
</p></div>
|
98 |
<?php
|
99 |
}
|
115 |
<p><?php _e('To use this plugin you need to sign up with Typekit, and then configure the following options.', 'typekit-fonts-for-wordpress'); ?></p>
|
116 |
<h3><?php _e('Register with Typekit', 'typekit-fonts-for-wordpress'); ?></h3>
|
117 |
<ol>
|
118 |
+
<li><?php printf( __('Go to <a href="%s" target="blank">typekit.com</a> and register for an account.', 'typekit-fonts-for-wordpress'), 'https://typekit.com/'); ?></li>
|
119 |
+
<li><?php _e('Choose a few fonts to add to your account and Publish them.', 'typekit-fonts-for-wordpress'); ?></li>
|
120 |
+
<li id="getembedcode"><?php _e('Go to the Kit Editor (link at the top right of the screen) then click on the Embed Code option.', 'typekit-fonts-for-wordpress'); ?></li>
|
121 |
</ol>
|
122 |
<h3><?php _e('Plugin Configuration', 'typekit-fonts-for-wordpress'); ?></h3>
|
123 |
<ol start="4">
|
124 |
+
<li><?php _e('Enter your Typekit Kit ID (shown at the bottom of the Embed Code screen).', 'typekit-fonts-for-wordpress'); ?><br />
|
125 |
+
<p class="option"><label for="kitid"><?php _e('Typekit Kit ID:', 'typekit-fonts-for-wordpress'); ?></label> <input type="text" name="kitid" value="<?php echo esc_attr( $this->typekitInstance->GetAccountID() ); ?>" /><br />
|
126 |
</li>
|
127 |
+
<li><?php _e('Choose your Preferred Embed Method.', 'typekit-fonts-for-wordpress'); ?><br />
|
128 |
+
<p class="option"><label for="method"><?php _e('Embed Method:', 'typekit-fonts-for-wordpress'); ?></label>
|
129 |
+
<select name="method">
|
130 |
+
<option value="css"<?php echo selected( $this->typekitInstance->GetEmbedMethod(), 'css' ); ?>><?php _e('CSS Link (Simplest)', 'typekit-fonts-for-wordpress'); ?></option>
|
131 |
+
<option value="js"<?php echo selected( $this->typekitInstance->GetEmbedMethod(), 'js' ); ?>><?php _e('Javascript (Advanced)', 'typekit-fonts-for-wordpress'); ?></option>
|
132 |
+
</select>
|
133 |
+
</li>
|
134 |
+
|
135 |
<li><?php _e('You can add selectors using the Typekit Kit Editor. Alternatively you can define your own CSS rules in your own style sheet or using the Custom CSS Rules field below (technical note: these CSS rules will be embedded in the header of each page). Look at the advanced examples shown in the Typekit editor for ideas.', 'typekit-fonts-for-wordpress'); ?>
|
136 |
<p class="option"><label for="css"><?php _e('Custom CSS Rules:', 'typekit-fonts-for-wordpress'); ?></label> <textarea name="css" rows="10" cols="80"><?php echo esc_textarea( $this->typekitInstance->GetCSSRules() ); ?></textarea><br />
|
137 |
<a href="#help-css"><?php _e('Click here for help on CSS', 'typekit-fonts-for-wordpress'); ?></a>
|
typekit.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Typekit Fonts for WordPress
|
4 |
Plugin URI: https://om4.com.au/plugins/typekit-fonts-for-wordpress-plugin/
|
5 |
Description: Use a range of hundreds of high quality fonts on your WordPress website by integrating the <a href="http://typekit.com">Typekit</a> font service into your WordPress blog.
|
6 |
-
Version: 1.
|
7 |
Author: OM4
|
8 |
Author URI: https://om4.com.au/plugins/
|
9 |
Text Domain: typekit-fonts-for-wordpress
|
@@ -40,37 +40,41 @@ class OM4_Typekit {
|
|
40 |
private $optionName = 'OM4_Typekit';
|
41 |
|
42 |
private $admin;
|
43 |
-
|
44 |
-
public $
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
58 |
/**
|
59 |
-
* The format for the Typekit
|
60 |
*
|
61 |
* @var string
|
62 |
*/
|
63 |
-
public $embedcodeurl = 'https://use.typekit.net/%s.
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
public $embedcodeasyncregexp = '#async: (true|false)#i';
|
66 |
-
|
67 |
/*
|
68 |
* Default settings
|
69 |
*/
|
70 |
private $settings = array(
|
71 |
'id'=> '',
|
|
|
72 |
'css' => '',
|
73 |
-
'async' =>
|
74 |
);
|
75 |
|
76 |
/**
|
@@ -160,14 +164,22 @@ class OM4_Typekit {
|
|
160 |
*/
|
161 |
public function GetEmbedCode() {
|
162 |
if ( '' != $id = $this->GetAccountID() ) {
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
return '';
|
167 |
}
|
168 |
|
169 |
/**
|
170 |
-
* Get the stored Typekit Account ID
|
171 |
* @return string The account ID if it has been specified, otherwise an empty string
|
172 |
*/
|
173 |
public function GetAccountID() {
|
@@ -189,26 +201,38 @@ class OM4_Typekit {
|
|
189 |
return true;
|
190 |
}
|
191 |
}
|
192 |
-
|
193 |
/**
|
194 |
-
*
|
195 |
-
*
|
|
|
196 |
*/
|
197 |
-
public function
|
198 |
-
|
199 |
-
|
200 |
-
$this->settings['id'] = '';
|
201 |
-
// Attempt to extract the kit ID from the embed code using our regular expression
|
202 |
-
if ( preg_match( $this->embedcoderegexp, $code, $matches ) && 4 == sizeof( $matches ) ) {
|
203 |
-
$this->settings['id'] = $matches[3];
|
204 |
-
}
|
205 |
-
|
206 |
-
if ( preg_match( $this->embedcodeasyncregexp, $code, $matches ) && 2 == sizeof( $matches ) && 'false' === $matches[1] ) {
|
207 |
-
$this->settings['async'] = false;
|
208 |
} else {
|
209 |
-
|
|
|
210 |
}
|
211 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
/*
|
214 |
* Retrieve the custom CSS rules
|
3 |
Plugin Name: Typekit Fonts for WordPress
|
4 |
Plugin URI: https://om4.com.au/plugins/typekit-fonts-for-wordpress-plugin/
|
5 |
Description: Use a range of hundreds of high quality fonts on your WordPress website by integrating the <a href="http://typekit.com">Typekit</a> font service into your WordPress blog.
|
6 |
+
Version: 1.9.0
|
7 |
Author: OM4
|
8 |
Author URI: https://om4.com.au/plugins/
|
9 |
Text Domain: typekit-fonts-for-wordpress
|
40 |
private $optionName = 'OM4_Typekit';
|
41 |
|
42 |
private $admin;
|
43 |
+
|
44 |
+
public $embedcode_advanced = '<script>
|
45 |
+
(function(d) {
|
46 |
+
var config = {
|
47 |
+
kitId: \'%1$s\',
|
48 |
+
scriptTimeout: 3000,
|
49 |
+
async: %2$s
|
50 |
+
},
|
51 |
+
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src=\'https://use.typekit.net/\'+config.kitId+\'.js\';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
|
52 |
+
})(document);
|
53 |
+
</script>';
|
54 |
+
|
55 |
+
public $embedcode_css = '<link rel="stylesheet" href="https://use.typekit.net/%s.css">';
|
56 |
+
|
57 |
+
public $kitid_regexp = '#([a-z0-9]*)#i';
|
58 |
+
|
59 |
/**
|
60 |
+
* The format for the Typekit CSS file URL. Used in HTTP requests to verify that the URL doesn't produce a 404 error
|
61 |
*
|
62 |
* @var string
|
63 |
*/
|
64 |
+
public $embedcodeurl = 'https://use.typekit.net/%s.css';
|
65 |
+
|
66 |
+
const EMBED_METHOD_CSS = 'css';
|
67 |
+
|
68 |
+
const EMBED_METHOD_JAVASCRIPT = 'js';
|
69 |
|
|
|
|
|
70 |
/*
|
71 |
* Default settings
|
72 |
*/
|
73 |
private $settings = array(
|
74 |
'id'=> '',
|
75 |
+
'method' => self::EMBED_METHOD_CSS,
|
76 |
'css' => '',
|
77 |
+
'async' => '',
|
78 |
);
|
79 |
|
80 |
/**
|
164 |
*/
|
165 |
public function GetEmbedCode() {
|
166 |
if ( '' != $id = $this->GetAccountID() ) {
|
167 |
+
|
168 |
+
switch( $this->GetEmbedMethod() ) {
|
169 |
+
case self::EMBED_METHOD_CSS:
|
170 |
+
return sprintf( $this->embedcode_css, $id );
|
171 |
+
break;
|
172 |
+
case self::EMBED_METHOD_JAVASCRIPT:
|
173 |
+
$async = $this->GetAsync() ? 'true' : 'false';
|
174 |
+
return sprintf( $this->embedcode_advanced, $id, $async );
|
175 |
+
break;
|
176 |
+
}
|
177 |
}
|
178 |
return '';
|
179 |
}
|
180 |
|
181 |
/**
|
182 |
+
* Get the stored Typekit Account/Kit ID
|
183 |
* @return string The account ID if it has been specified, otherwise an empty string
|
184 |
*/
|
185 |
public function GetAccountID() {
|
201 |
return true;
|
202 |
}
|
203 |
}
|
204 |
+
|
205 |
/**
|
206 |
+
* Get the stored value for the embed method.
|
207 |
+
*
|
208 |
+
* @return bool
|
209 |
*/
|
210 |
+
public function GetEmbedMethod() {
|
211 |
+
if ( isset( $this->settings['method'] ) ) {
|
212 |
+
return $this->settings['method'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
} else {
|
214 |
+
// No embed method chosen, so default to the JS method
|
215 |
+
return self::EMBED_METHOD_JAVASCRIPT;
|
216 |
}
|
217 |
}
|
218 |
+
|
219 |
+
public function ParseKitID( $id ) {
|
220 |
+
if ( preg_match( $this->kitid_regexp, $id, $matches ) && 2 == sizeof( $matches ) ) {
|
221 |
+
$this->settings['id'] = $matches[0];
|
222 |
+
} else {
|
223 |
+
$this->settings['id'] = '';
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
public function ParseEmbedMethod( $method ) {
|
228 |
+
if ( $method == self::EMBED_METHOD_JAVASCRIPT ) {
|
229 |
+
$this->settings['method'] = self::EMBED_METHOD_JAVASCRIPT;
|
230 |
+
} else {
|
231 |
+
$this->settings['method'] = self::EMBED_METHOD_CSS;
|
232 |
+
$this->settings['async'] = '';
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
|
237 |
/*
|
238 |
* Retrieve the custom CSS rules
|