jetpack-fonts.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <?php
  2. add_filter( 'typekit_add_font_category_rules', function( $category_rules ) {
  3. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  4. 'html',
  5. array(
  6. array( 'property' => 'font-family', 'value' => 'sans-serif' ),
  7. )
  8. );
  9. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  10. 'b,
  11. strong',
  12. array(
  13. array( 'property' => 'font-weight', 'value' => 'bold' ),
  14. )
  15. );
  16. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  17. 'dfn',
  18. array(
  19. array( 'property' => 'font-style', 'value' => 'italic' ),
  20. )
  21. );
  22. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  23. 'h1',
  24. array(
  25. array( 'property' => 'font-size', 'value' => '2em' ),
  26. )
  27. );
  28. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  29. 'small',
  30. array(
  31. array( 'property' => 'font-size', 'value' => '80%' ),
  32. )
  33. );
  34. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  35. 'sub,
  36. sup',
  37. array(
  38. array( 'property' => 'font-size', 'value' => '75%' ),
  39. )
  40. );
  41. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  42. 'code,
  43. kbd,
  44. pre,
  45. samp',
  46. array(
  47. array( 'property' => 'font-size', 'value' => '1em' ),
  48. )
  49. );
  50. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  51. 'optgroup',
  52. array(
  53. array( 'property' => 'font-weight', 'value' => 'bold' ),
  54. )
  55. );
  56. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  57. '.screen-reader-text:focus',
  58. array(
  59. array( 'property' => 'font-size', 'value' => '14px' ),
  60. array( 'property' => 'font-weight', 'value' => 'bold' ),
  61. )
  62. );
  63. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  64. 'body,
  65. button,
  66. input,
  67. select,
  68. textarea,
  69. #respond,
  70. .highlander-enabled #respond,
  71. .highlander-enabled #respond .form-submit input,
  72. .highlander-enabled #respond .form-submit input#comment-submit,
  73. .highlander-enabled #respond .comment-form-fields input[type=submit],
  74. .highlander-enabled #respond p.form-submit input[type=submit],
  75. .highlander-enabled #respond input[type=submit],
  76. .highlander-enabled #respond #commentform #comment-submit,
  77. .comment-reply-title small,
  78. #jp-post-flair h3.sd-title,
  79. #jp-post-flair div.sharedaddy h3.sd-title,
  80. #jp-post-flair .jp-relatedposts .jp-relatedposts-headline em',
  81. array(
  82. array( 'property' => 'font-family', 'value' => '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  83. array( 'property' => 'font-size', 'value' => '16px' ),
  84. array( 'property' => 'font-weight', 'value' => '300' ),
  85. )
  86. );
  87. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  88. '.testimonials .hentry .entry-title,
  89. .card .entry-title,
  90. .comment-author .fn',
  91. array(
  92. array( 'property' => 'font-size', 'value' => '24px' ),
  93. array( 'property' => 'font-family', 'value' => '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  94. array( 'property' => 'font-weight', 'value' => '600' ),
  95. )
  96. );
  97. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  98. 'h1,
  99. h2,
  100. h3,
  101. h4,
  102. h5,
  103. h6,
  104. .single .hentry .entry-title',
  105. array(
  106. array( 'property' => 'font-family', 'value' => '"Playfair Display SC", "Times New Roman", Times, serif' ),
  107. )
  108. );
  109. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  110. 'cite,
  111. dfn,
  112. em,
  113. i',
  114. array(
  115. array( 'property' => 'font-style', 'value' => 'italic' ),
  116. )
  117. );
  118. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  119. 'blockquote,
  120. .testimonials .entry-content p',
  121. array(
  122. array( 'property' => 'font-family', 'value' => '"Playfair Display", "Times New Roman", Times, serif' ),
  123. array( 'property' => 'font-size', 'value' => '20px' ),
  124. array( 'property' => 'font-style', 'value' => 'normal' ),
  125. )
  126. );
  127. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  128. 'pre',
  129. array(
  130. array( 'property' => 'font-size', 'value' => '15px' ),
  131. )
  132. );
  133. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  134. 'code,
  135. kbd,
  136. tt,
  137. var',
  138. array(
  139. array( 'property' => 'font-size', 'value' => '15px' ),
  140. )
  141. );
  142. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  143. 'big',
  144. array(
  145. array( 'property' => 'font-size', 'value' => '125%' ),
  146. )
  147. );
  148. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  149. 'button,
  150. input[type="button"],
  151. input[type="reset"],
  152. input[type="submit"]',
  153. array(
  154. array( 'property' => 'font-size', 'value' => '16px' ),
  155. array( 'property' => 'font-weight', 'value' => '600' ),
  156. )
  157. );
  158. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  159. 'button:hover,
  160. input[type="button"]:hover,
  161. input[type="reset"]:hover,
  162. input[type="submit"]:hover',
  163. array(
  164. array( 'property' => 'font-weight', 'value' => '600' ),
  165. )
  166. );
  167. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  168. 'dt',
  169. array(
  170. array( 'property' => 'font-weight', 'value' => 'bold' ),
  171. )
  172. );
  173. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  174. '.entry-content table thead tr',
  175. array(
  176. array( 'property' => 'font-size', 'value' => '12.8px' ),
  177. array( 'property' => 'font-weight', 'value' => '700' ),
  178. )
  179. );
  180. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  181. '.main-navigation .children a:before,
  182. .main-navigation .sub-menu a:before',
  183. array(
  184. array( 'property' => 'font-weight', 'value' => '100' ),
  185. )
  186. );
  187. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  188. '.main-navigation a',
  189. array(
  190. array( 'property' => 'font-weight', 'value' => '600' ),
  191. )
  192. );
  193. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  194. '.main-navigation .dropdown-toggle:after',
  195. array(
  196. array( 'property' => 'font-size', 'value' => '16px' ),
  197. )
  198. );
  199. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  200. '.main-navigation a span',
  201. array(
  202. array( 'property' => 'font-size', 'value' => '12px' ),
  203. array( 'property' => 'font-weight', 'value' => '300' ),
  204. )
  205. );
  206. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  207. '.main-navigation .dropdown-toggle:after',
  208. array(
  209. array( 'property' => 'font-size', 'value' => '12px' ),
  210. )
  211. );
  212. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  213. '.footer-navigation a',
  214. array(
  215. array( 'property' => 'font-size', 'value' => '12px' ),
  216. array( 'property' => 'font-weight', 'value' => '700' ),
  217. )
  218. );
  219. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  220. '.comment-navigation a .meta-nav,
  221. .post-navigation a .meta-nav,
  222. .posts-navigation a .meta-nav',
  223. array(
  224. array( 'property' => 'font-size', 'value' => '12px' ),
  225. array( 'property' => 'font-weight', 'value' => '700' ),
  226. )
  227. );
  228. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  229. '.comment-navigation a .meta-title,
  230. .post-navigation a .meta-title,
  231. .posts-navigation a .meta-title',
  232. array(
  233. array( 'property' => 'font-size', 'value' => '24px' ),
  234. array( 'property' => 'font-family', 'value' => '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  235. array( 'property' => 'font-weight', 'value' => '600' ),
  236. array( 'property' => 'font-size', 'value' => '18px' ),
  237. )
  238. );
  239. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  240. '.comment-navigation.comment-navigation a,
  241. .post-navigation.comment-navigation a,
  242. .posts-navigation.comment-navigation a',
  243. array(
  244. array( 'property' => 'font-size', 'value' => '24px' ),
  245. array( 'property' => 'font-family', 'value' => '"Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  246. array( 'property' => 'font-weight', 'value' => '600' ),
  247. array( 'property' => 'font-size', 'value' => '18px' ),
  248. )
  249. );
  250. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  251. '.comment-navigation a .meta-title,
  252. .post-navigation a .meta-title,
  253. .posts-navigation a .meta-title',
  254. array(
  255. array( 'property' => 'font-size', 'value' => '24px' ),
  256. )
  257. );
  258. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  259. '.site-branding .site-title,
  260. .featured-content-inner .hentry .entry-title',
  261. array(
  262. array( 'property' => 'font-family', 'value' => '"Playfair Display SC", "Times New Roman", Times, serif' ),
  263. array( 'property' => 'font-size', 'value' => '24px' ),
  264. array( 'property' => 'font-weight', 'value' => '600' ),
  265. )
  266. );
  267. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  268. '.site-branding .site-title',
  269. array(
  270. array( 'property' => 'font-size', 'value' => '24px' ),
  271. )
  272. );
  273. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  274. '.search-box .search-field',
  275. array(
  276. array( 'property' => 'font-size', 'value' => '16px' ),
  277. array( 'property' => 'font-weight', 'value' => '300' ),
  278. )
  279. );
  280. return $category_rules;
  281. } );