jetpack-fonts.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <?php
  2. add_filter( 'typekit_add_font_category_rules', function( $category_rules ) {
  3. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  4. 'b,
  5. strong',
  6. array(
  7. array( 'property' => 'font-weight', 'value' => 'bold' ),
  8. )
  9. );
  10. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  11. 'dfn',
  12. array(
  13. array( 'property' => 'font-style', 'value' => 'italic' ),
  14. )
  15. );
  16. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  17. 'h1',
  18. array(
  19. array( 'property' => 'font-size', 'value' => '2em' ),
  20. )
  21. );
  22. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  23. 'small',
  24. array(
  25. array( 'property' => 'font-size', 'value' => '80%' ),
  26. )
  27. );
  28. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  29. 'sub,
  30. sup',
  31. array(
  32. array( 'property' => 'font-size', 'value' => '75%' ),
  33. )
  34. );
  35. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  36. 'code,
  37. kbd,
  38. pre',
  39. array(
  40. array( 'property' => 'font-family', 'value' => 'monospace, monospace' ),
  41. array( 'property' => 'font-size', 'value' => '1em' ),
  42. )
  43. );
  44. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  45. 'samp',
  46. array(
  47. array( 'property' => 'font-family', 'value' => 'monospace, monospace' ),
  48. array( 'property' => 'font-size', 'value' => '1em' ),
  49. )
  50. );
  51. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  52. 'button,
  53. input,
  54. optgroup,
  55. select,
  56. textarea',
  57. array(
  58. array( 'property' => 'font', 'value' => 'inherit' ),
  59. )
  60. );
  61. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  62. 'optgroup',
  63. array(
  64. array( 'property' => 'font-weight', 'value' => 'bold' ),
  65. )
  66. );
  67. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  68. '.screen-reader-text:focus',
  69. array(
  70. array( 'property' => 'font-size', 'value' => '14px' ),
  71. array( 'property' => 'font-weight', 'value' => 'bold' ),
  72. )
  73. );
  74. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  75. 'body,
  76. button,
  77. input,
  78. select,
  79. textarea',
  80. array(
  81. array( 'property' => 'font-family', 'value' => '"Cooper Hewitt", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  82. array( 'property' => 'font-weight', 'value' => '500' ),
  83. array( 'property' => 'font-size', 'value' => '16px' ),
  84. )
  85. );
  86. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  87. '.site-main',
  88. array(
  89. array( 'property' => 'font-size', 'value' => '18px' ),
  90. )
  91. );
  92. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  93. 'h1,
  94. h2,
  95. h3,
  96. h4,
  97. h5,
  98. h6',
  99. array(
  100. array( 'property' => 'font-family', 'value' => '"Archivo Narrow", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  101. array( 'property' => 'font-weight', 'value' => 'bold' ),
  102. )
  103. );
  104. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  105. 'h1',
  106. array(
  107. array( 'property' => 'font-size', 'value' => '36px' ),
  108. )
  109. );
  110. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  111. 'h2',
  112. array(
  113. array( 'property' => 'font-size', 'value' => '32px' ),
  114. )
  115. );
  116. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  117. 'h3',
  118. array(
  119. array( 'property' => 'font-size', 'value' => '24px' ),
  120. )
  121. );
  122. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  123. 'h4',
  124. array(
  125. array( 'property' => 'font-size', 'value' => '20px' ),
  126. )
  127. );
  128. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  129. 'h5',
  130. array(
  131. array( 'property' => 'font-size', 'value' => '16px' ),
  132. )
  133. );
  134. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  135. 'h6',
  136. array(
  137. array( 'property' => 'font-size', 'value' => '14px' ),
  138. )
  139. );
  140. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  141. 'cite,
  142. dfn,
  143. em,
  144. i',
  145. array(
  146. array( 'property' => 'font-style', 'value' => 'italic' ),
  147. )
  148. );
  149. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  150. 'pre',
  151. array(
  152. array( 'property' => 'font-family', 'value' => '"Courier 10 Pitch", Courier, monospace' ),
  153. array( 'property' => 'font-size', 'value' => '15px' ),
  154. )
  155. );
  156. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  157. 'code,
  158. kbd,
  159. tt,
  160. var',
  161. array(
  162. array( 'property' => 'font-family', 'value' => 'Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace' ),
  163. array( 'property' => 'font-size', 'value' => '15px' ),
  164. )
  165. );
  166. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  167. 'big',
  168. array(
  169. array( 'property' => 'font-size', 'value' => '125%' ),
  170. )
  171. );
  172. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  173. '#infinite-handle span,
  174. .button,
  175. button,
  176. input[type="button"],
  177. input[type="reset"],
  178. input[type="submit"]',
  179. array(
  180. array( 'property' => 'font-size', 'value' => '16px' ),
  181. array( 'property' => 'font-weight', 'value' => 'bold' ),
  182. )
  183. );
  184. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  185. '.comment-navigation .nav-next a,
  186. .comment-navigation .nav-previous a,
  187. .header-overlay .button,
  188. .main-navigation .menu-toggle,
  189. .post-navigation .nav-next a,
  190. .post-navigation .nav-previous a,
  191. .posts-navigation .nav-next a,
  192. .posts-navigation .nav-previous a',
  193. array(
  194. array( 'property' => 'font-size', 'value' => '16px' ),
  195. array( 'property' => 'font-weight', 'value' => 'bold' ),
  196. )
  197. );
  198. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  199. '.comment-list .reply,
  200. .comment-metadata,
  201. .entry-footer,
  202. .entry-meta,
  203. .widget_recent_entries .post-date,
  204. .widget_rss .rss-date',
  205. array(
  206. array( 'property' => 'font-family', 'value' => '"Archivo Narrow", sans-serif' ),
  207. array( 'property' => 'font-size', 'value' => '14px' ),
  208. )
  209. );
  210. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  211. 'dt',
  212. array(
  213. array( 'property' => 'font-weight', 'value' => 'bold' ),
  214. )
  215. );
  216. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  217. '.main-navigation .menu-toggle',
  218. array(
  219. array( 'property' => 'font-size', 'value' => '14px' ),
  220. )
  221. );
  222. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  223. '.main-navigation .menu-toggle:before',
  224. array(
  225. array( 'property' => 'font-family', 'value' => 'Genericons' ),
  226. array( 'property' => 'font-weight', 'value' => '300' ),
  227. )
  228. );
  229. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  230. '.comment-navigation .nav-next a,
  231. .comment-navigation .nav-previous a,
  232. .post-navigation .nav-next a,
  233. .post-navigation .nav-previous a,
  234. .posts-navigation .nav-next a,
  235. .posts-navigation .nav-previous a',
  236. array(
  237. array( 'property' => 'font-size', 'value' => '16px' ),
  238. )
  239. );
  240. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  241. '.entry-title',
  242. array(
  243. array( 'property' => 'font-size', 'value' => '24px' ),
  244. )
  245. );
  246. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  247. '.singular .entry-title',
  248. array(
  249. array( 'property' => 'font-size', 'value' => '36px' ),
  250. )
  251. );
  252. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  253. '.more-link',
  254. array(
  255. array( 'property' => 'font-size', 'value' => '14px' ),
  256. )
  257. );
  258. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  259. '.author-title',
  260. array(
  261. array( 'property' => 'font-family', 'value' => '"Archivo Narrow", sans-serif' ),
  262. array( 'property' => 'font-size', 'value' => '14px' ),
  263. )
  264. );
  265. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  266. '.author-name',
  267. array(
  268. array( 'property' => 'font-size', 'value' => '24px' ),
  269. array( 'property' => 'font-weight', 'value' => 'bold' ),
  270. )
  271. );
  272. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  273. '.front-testimonials .hentry:after',
  274. array(
  275. array( 'property' => 'font-size', 'value' => '144px' ),
  276. array( 'property' => 'font-weight', 'value' => 'bold' ),
  277. )
  278. );
  279. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  280. '.front-testimonials .hentry p:first-of-type',
  281. array(
  282. array( 'property' => 'font-weight', 'value' => 'bold' ),
  283. )
  284. );
  285. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  286. '.front-testimonials .entry-title',
  287. array(
  288. array( 'property' => 'font-size', 'value' => '18px' ),
  289. )
  290. );
  291. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  292. '.recent-posts-title,
  293. .page-title',
  294. array(
  295. array( 'property' => 'font-size', 'value' => '32px' ),
  296. )
  297. );
  298. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  299. '.more-recent-posts',
  300. array(
  301. array( 'property' => 'font-size', 'value' => '14px' ),
  302. )
  303. );
  304. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  305. '.more-testimonials,
  306. .more-testimonials:visited',
  307. array(
  308. array( 'property' => 'font-size', 'value' => '14px' ),
  309. )
  310. );
  311. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  312. '.meta-nav',
  313. array(
  314. array( 'property' => 'font-size', 'value' => '12px' ),
  315. )
  316. );
  317. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  318. '.no-comments',
  319. array(
  320. array( 'property' => 'font-style', 'value' => 'italic' ),
  321. )
  322. );
  323. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  324. '.comment-author',
  325. array(
  326. array( 'property' => 'font-size', 'value' => '16px' ),
  327. )
  328. );
  329. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  330. '.comment-author b.fn',
  331. array(
  332. array( 'property' => 'font-weight', 'value' => '500' ),
  333. )
  334. );
  335. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  336. '.comment-metadata',
  337. array(
  338. array( 'property' => 'font-weight', 'value' => 'normal' ),
  339. )
  340. );
  341. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  342. '#respond h3,
  343. .comments-title',
  344. array(
  345. array( 'property' => 'font-size', 'value' => '32px' ),
  346. )
  347. );
  348. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  349. '.widget',
  350. array(
  351. array( 'property' => 'font-size', 'value' => '18px' ),
  352. )
  353. );
  354. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  355. '.widget-title',
  356. array(
  357. array( 'property' => 'font-size', 'value' => '24px' ),
  358. )
  359. );
  360. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  361. '.search-form-icon:before',
  362. array(
  363. array( 'property' => 'font-size', 'value' => '20px' ),
  364. array( 'property' => 'font-family', 'value' => 'Genericons' ),
  365. array( 'property' => 'font-style', 'value' => 'normal' ),
  366. array( 'property' => 'font-weight', 'value' => '600' ),
  367. )
  368. );
  369. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  370. '.search-form ::-webkit-input-body-text',
  371. array(
  372. array( 'property' => 'font-size', 'value' => '14px' ),
  373. array( 'property' => 'font-family', 'value' => '"Archivo Narrow", sans-serif' ),
  374. )
  375. );
  376. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  377. '.footer-widgets .widget',
  378. array(
  379. array( 'property' => 'font-size', 'value' => '16px' ),
  380. )
  381. );
  382. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  383. '.footer-widgets .widget-title',
  384. array(
  385. array( 'property' => 'font-size', 'value' => '14px' ),
  386. )
  387. );
  388. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  389. '.site-title',
  390. array(
  391. array( 'property' => 'font-family', 'value' => '"Cooper Hewitt", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  392. array( 'property' => 'font-size', 'value' => '36px' ),
  393. array( 'property' => 'font-weight', 'value' => '700' ),
  394. )
  395. );
  396. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  397. '.site-description',
  398. array(
  399. array( 'property' => 'font-size', 'value' => '36px' ),
  400. array( 'property' => 'font-weight', 'value' => 'bold' ),
  401. array( 'property' => 'font-family', 'value' => '"Archivo Narrow", sans-serif' ),
  402. )
  403. );
  404. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  405. '.featured-content .hentry .entry-title',
  406. array(
  407. array( 'property' => 'font-size', 'value' => '20px' ),
  408. )
  409. );
  410. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  411. '.site-header .jetpack-social-navigation a:before',
  412. array(
  413. array( 'property' => 'font-size', 'value' => '16px' ),
  414. )
  415. );
  416. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  417. '.site-info',
  418. array(
  419. array( 'property' => 'font-family', 'value' => '"Archivo Narrow", "Helvetica Neue", Helvetica, Arial, sans-serif' ),
  420. array( 'property' => 'font-size', 'value' => '14px' ),
  421. )
  422. );
  423. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  424. '.main-navigation .nav-menu > li > a',
  425. array(
  426. array( 'property' => 'font-family', 'value' => '"Archivo Narrow", sans-serif' ),
  427. )
  428. );
  429. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  430. '.main-navigation ul ul',
  431. array(
  432. array( 'property' => 'font-size', 'value' => '16px' ),
  433. )
  434. );
  435. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  436. '.main-navigation ul ul:before',
  437. array(
  438. array( 'property' => 'font-family', 'value' => 'Genericons' ),
  439. array( 'property' => 'font-size', 'value' => '16px' ),
  440. )
  441. );
  442. TypekitTheme::add_font_category_rule( $category_rules, 'none',
  443. '.main-navigation ul > li.menu-item-has-children > a:after,
  444. .main-navigation ul > li.page_item_has_children > a:after',
  445. array(
  446. array( 'property' => 'font-family', 'value' => 'Genericons' ),
  447. )
  448. );
  449. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  450. '.featured-content .hentry .entry-title',
  451. array(
  452. array( 'property' => 'font-size', 'value' => '16px' ),
  453. )
  454. );
  455. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  456. '.site-description',
  457. array(
  458. array( 'property' => 'font-size', 'value' => '48px' ),
  459. ),
  460. array(
  461. 'screen and (min-width: 37.5em)',
  462. )
  463. );
  464. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  465. '.site-title',
  466. array(
  467. array( 'property' => 'font-size', 'value' => '48px' ),
  468. ),
  469. array(
  470. 'screen and (min-width: 37.5em)',
  471. )
  472. );
  473. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  474. '.recent-posts-title,
  475. .page-title',
  476. array(
  477. array( 'property' => 'font-size', 'value' => '36px' ),
  478. ),
  479. array(
  480. 'screen and (min-width: 37.5em)',
  481. )
  482. );
  483. return $category_rules;
  484. } );