jetpack-fonts.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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, 'body-text',
  17. 'optgroup',
  18. array(
  19. array( 'property' => 'font-weight', 'value' => 'bold' ),
  20. )
  21. );
  22. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  23. 'body,
  24. button,
  25. input,
  26. select,
  27. textarea',
  28. array(
  29. array( 'property' => 'font-family', 'value' => '"PT Serif", serif' ),
  30. array( 'property' => 'font-size', 'value' => '16px' ),
  31. )
  32. );
  33. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  34. 'h1,
  35. h2:not(site-description):not(.author-title),
  36. h3,
  37. h4,
  38. h5,
  39. h6',
  40. array(
  41. array( 'property' => 'font-family', 'value' => '"Playfair Display", serif' ),
  42. array( 'property' => 'font-weight', 'value' => 'bold' ),
  43. )
  44. );
  45. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  46. 'h1',
  47. array(
  48. array( 'property' => 'font-size', 'value' => '49px' ),
  49. )
  50. );
  51. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  52. 'h2:not(site-description):not(.author-title)',
  53. array(
  54. array( 'property' => 'font-size', 'value' => '39px' ),
  55. )
  56. );
  57. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  58. 'h3',
  59. array(
  60. array( 'property' => 'font-size', 'value' => '31px' ),
  61. )
  62. );
  63. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  64. 'h4',
  65. array(
  66. array( 'property' => 'font-size', 'value' => '25px' ),
  67. )
  68. );
  69. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  70. 'h5',
  71. array(
  72. array( 'property' => 'font-size', 'value' => '20px' ),
  73. )
  74. );
  75. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  76. 'h6',
  77. array(
  78. array( 'property' => 'font-size', 'value' => '16px' ),
  79. )
  80. );
  81. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  82. 'cite,
  83. dfn,
  84. em,
  85. i',
  86. array(
  87. array( 'property' => 'font-style', 'value' => 'italic' ),
  88. )
  89. );
  90. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  91. 'cite',
  92. array(
  93. array( 'property' => 'font-wieght', 'value' => 'bold' ),
  94. )
  95. );
  96. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  97. 'blockquote',
  98. array(
  99. array( 'property' => 'font-style', 'value' => 'italic' ),
  100. )
  101. );
  102. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  103. 'blockquote cite',
  104. array(
  105. array( 'property' => 'font-style', 'value' => 'normal' ),
  106. )
  107. );
  108. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  109. 'dt',
  110. array(
  111. array( 'property' => 'font-weight', 'value' => 'bold' ),
  112. )
  113. );
  114. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  115. 'a',
  116. array(
  117. array( 'property' => 'font-weight', 'value' => 'bold' ),
  118. )
  119. );
  120. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  121. 'a:visited',
  122. array(
  123. array( 'property' => 'font-weight', 'value' => 'normal' ),
  124. )
  125. );
  126. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  127. '.main-navigation',
  128. array(
  129. array( 'property' => 'font-size', 'value' => '16px' ),
  130. )
  131. );
  132. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  133. '.secondary-navigation,
  134. .footer-navigation,
  135. .bottom-navigation',
  136. array(
  137. array( 'property' => 'font-size', 'value' => '13px' ),
  138. )
  139. );
  140. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  141. '.comment-navigation a,
  142. .posts-navigation a',
  143. array(
  144. array( 'property' => 'font-size', 'value' => '16px' ),
  145. )
  146. );
  147. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  148. '.post-navigation .post-title',
  149. array(
  150. array( 'property' => 'font-family', 'value' => '"Playfair Display", serif' ),
  151. array( 'property' => 'font-size', 'value' => '25px' ),
  152. array( 'property' => 'font-weight', 'value' => 'bold' ),
  153. )
  154. );
  155. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  156. '.widget',
  157. array(
  158. array( 'property' => 'font-size', 'value' => '16px' ),
  159. )
  160. );
  161. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  162. '.widget-title,
  163. .widgettitle',
  164. array(
  165. array( 'property' => 'font-size', 'value' => '25px' ),
  166. )
  167. );
  168. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  169. '.widget_recent_entries .post-date',
  170. array(
  171. array( 'property' => 'font-size', 'value' => '13px' ),
  172. )
  173. );
  174. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  175. '.widget_rss .rss-date,
  176. .widget_rss cite',
  177. array(
  178. array( 'property' => 'font-size', 'value' => '13px' ),
  179. )
  180. );
  181. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  182. '.site-title',
  183. array(
  184. array( 'property' => 'font-size', 'value' => '25px' ),
  185. )
  186. );
  187. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  188. '.site-description',
  189. array(
  190. array( 'property' => 'font-size', 'value' => '16px' ),
  191. )
  192. );
  193. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  194. '.site-info',
  195. array(
  196. array( 'property' => 'font-size', 'value' => '13px' ),
  197. )
  198. );
  199. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  200. '.site-info .sep',
  201. array(
  202. array( 'property' => 'font-size', 'value' => '16px' ),
  203. )
  204. );
  205. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  206. '.featured-content .entry-title',
  207. array(
  208. array( 'property' => 'font-size', 'value' => '25px' ),
  209. )
  210. );
  211. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  212. '.entry-summary',
  213. array(
  214. array( 'property' => 'font-size', 'value' => '16px' ),
  215. )
  216. );
  217. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  218. '.page-title',
  219. array(
  220. array( 'property' => 'font-size', 'value' => '39px' ),
  221. )
  222. );
  223. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  224. '.archive .hentry .entry-title,
  225. .blog .hentry .entry-title,
  226. .search .hentry .entry-title',
  227. array(
  228. array( 'property' => 'font-size', 'value' => '25px' ),
  229. )
  230. );
  231. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  232. '.page .entry-title,
  233. .single .entry-title',
  234. array(
  235. array( 'property' => 'font-size', 'value' => '39px' ),
  236. )
  237. );
  238. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  239. '.entry-meta',
  240. array(
  241. array( 'property' => 'font-size', 'value' => '13px' ),
  242. )
  243. );
  244. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  245. '.entry-footer',
  246. array(
  247. array( 'property' => 'font-size', 'value' => '13px' ),
  248. )
  249. );
  250. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  251. '.page-links',
  252. array(
  253. array( 'property' => 'font-size', 'value' => '13px' ),
  254. )
  255. );
  256. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  257. '.author-info .author-title',
  258. array(
  259. array( 'property' => 'font-size', 'value' => '13px' ),
  260. )
  261. );
  262. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  263. '.author-info .author-name',
  264. array(
  265. array( 'property' => 'font-size', 'value' => '25px' ),
  266. )
  267. );
  268. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  269. '.author-info .author-bio',
  270. array(
  271. array( 'property' => 'font-size', 'value' => '16px' ),
  272. )
  273. );
  274. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  275. '.comments-area',
  276. array(
  277. array( 'property' => 'font-size', 'value' => '16px' ),
  278. )
  279. );
  280. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  281. '.comment-reply-title,
  282. .comments-title,
  283. .no-comments',
  284. array(
  285. array( 'property' => 'font-size', 'value' => '25px' ),
  286. )
  287. );
  288. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  289. '.no-comments',
  290. array(
  291. array( 'property' => 'font-family', 'value' => '"Playfair Display", sans-serif' ),
  292. array( 'property' => 'font-weight', 'value' => 'bold' ),
  293. )
  294. );
  295. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  296. '.comment-form,
  297. .comment-form code',
  298. array(
  299. array( 'property' => 'font-size', 'value' => '16px' ),
  300. )
  301. );
  302. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  303. '.comment-content blockquote:before',
  304. array(
  305. array( 'property' => 'font-size', 'value' => '16px' ),
  306. )
  307. );
  308. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  309. '.comment-author',
  310. array(
  311. array( 'property' => 'font-size', 'value' => '16px' ),
  312. array( 'property' => 'font-family', 'value' => '"Playfair Display", sans-serif' ),
  313. array( 'property' => 'font-weight', 'value' => 'bold' ),
  314. )
  315. );
  316. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  317. '.comment-author a,
  318. .comment-author b',
  319. array(
  320. array( 'property' => 'font-weight', 'value' => 'bold' ),
  321. )
  322. );
  323. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  324. '.comment-metadata .edit-link:before',
  325. array(
  326. array( 'property' => 'font-weight', 'value' => 'bold' ),
  327. )
  328. );
  329. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  330. '.comment-list .comment-reply-title small,
  331. .comment-metadata,
  332. .comment-reply-link',
  333. array(
  334. array( 'property' => 'font-size', 'value' => '13px' ),
  335. )
  336. );
  337. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  338. '.required',
  339. array(
  340. array( 'property' => 'font-weight', 'value' => 'bold' ),
  341. )
  342. );
  343. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  344. '.wp-caption',
  345. array(
  346. array( 'property' => 'font-size', 'value' => '16px' ),
  347. )
  348. );
  349. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  350. '.gallery-caption',
  351. array(
  352. array( 'property' => 'font-size', 'value' => '16px' ),
  353. )
  354. );
  355. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  356. '#infinite-handle span button,
  357. #infinite-handle span button:active,
  358. #infinite-handle span button:focus,
  359. #infinite-handle span button:hover',
  360. array(
  361. array( 'property' => 'font-size', 'value' => '16px' ),
  362. )
  363. );
  364. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  365. '#infinite-footer',
  366. array(
  367. array( 'property' => 'font-size', 'value' => '13px' ),
  368. )
  369. );
  370. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  371. '.hentry div.sd-rating h3.sd-title,
  372. .hentry div.sharedaddy h3.sd-title',
  373. array(
  374. array( 'property' => 'font-size', 'value' => '13px' ),
  375. )
  376. );
  377. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  378. '.hentry div#jp-relatedposts h3.jp-relatedposts-headline',
  379. array(
  380. array( 'property' => 'font-family', 'value' => '"P{layfair Display", sans-serif' ),
  381. array( 'property' => 'font-size', 'value' => '25px' ),
  382. array( 'property' => 'font-weight', 'value' => 'blod' ),
  383. )
  384. );
  385. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  386. '.hentry div#jp-relatedposts div.jp-relatedposts-items p',
  387. array(
  388. array( 'property' => 'font-size', 'value' => '16px' ),
  389. )
  390. );
  391. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  392. '.hentry div#jp-relatedposts div.jp-relatedposts-items .jp-relatedposts-post-context',
  393. array(
  394. array( 'property' => 'font-size', 'value' => '13px' ),
  395. )
  396. );
  397. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  398. '.hentry div#jp-relatedposts div.jp-relatedposts-items .jp-relatedposts-post-title',
  399. array(
  400. array( 'property' => 'font-family', 'value' => '"PT Serif", serif' ),
  401. array( 'property' => 'font-weight', 'value' => 'bold' ),
  402. )
  403. );
  404. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  405. '.hentry div#jp-relatedposts div.jp-relatedposts-items .jp-relatedposts-post-title',
  406. array(
  407. array( 'property' => 'font-size', 'value' => '16px' ),
  408. )
  409. );
  410. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  411. '.widget_jetpack_display_posts_widget .jetpack-display-remote-posts h4',
  412. array(
  413. array( 'property' => 'font-size', 'value' => '20px' ),
  414. )
  415. );
  416. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  417. '.widget_jetpack_display_posts_widget .jetpack-display-remote-posts p',
  418. array(
  419. array( 'property' => 'font-size', 'value' => '16px' ),
  420. )
  421. );
  422. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  423. '.widget_goodreads h2[class^="gr_custom_header"]',
  424. array(
  425. array( 'property' => 'font-size', 'value' => '20px' ),
  426. )
  427. );
  428. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  429. '.widget_goodreads div[class^="gr_custom_title"]',
  430. array(
  431. array( 'property' => 'font-weight', 'value' => 'bold' ),
  432. )
  433. );
  434. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  435. '.widget_goodreads div[class^="gr_custom_author"]',
  436. array(
  437. array( 'property' => 'font-size', 'value' => '13px' ),
  438. )
  439. );
  440. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  441. '.widget-grofile h4',
  442. array(
  443. array( 'property' => 'font-size', 'value' => '20px' ),
  444. )
  445. );
  446. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  447. 'body',
  448. array(
  449. array( 'property' => 'font-size', 'value' => '20px' ),
  450. ),
  451. array(
  452. 'screen and (min-width: 768px)',
  453. )
  454. );
  455. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  456. '.site-title',
  457. array(
  458. array( 'property' => 'font-size', 'value' => '49px' ),
  459. ),
  460. array(
  461. 'screen and (min-width: 768px)',
  462. )
  463. );
  464. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  465. 'body .hentry .wpcom-reblog-snapshot .reblogger-note-content blockquote',
  466. array(
  467. array( 'property' => 'font-style', 'value' => 'italic' ),
  468. )
  469. );
  470. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  471. '.aboutme_widget #am_name',
  472. array(
  473. array( 'property' => 'font-size', 'value' => '25px' ),
  474. )
  475. );
  476. TypekitTheme::add_font_category_rule( $category_rules, 'headings',
  477. '.aboutme_widget #am_headline',
  478. array(
  479. array( 'property' => 'font-size', 'value' => '20px' ),
  480. )
  481. );
  482. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  483. '.widget_akismet_widget .a-stats',
  484. array(
  485. array( 'property' => 'font-size', 'value' => '14px' ),
  486. )
  487. );
  488. TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
  489. '.widget_authors > ul > li > a',
  490. array(
  491. array( 'property' => 'font-family', 'value' => '"PT Serif", serif' ),
  492. )
  493. );
  494. return $category_rules;
  495. } );