项目作者: skapecollective

项目描述 :
ACF field for selecting Google Fonts
高级语言: PHP
项目地址: git://github.com/skapecollective/acf-google-fonts.git
创建时间: 2020-10-12T23:03:38Z
项目社区:https://github.com/skapecollective/acf-google-fonts

开源协议:

下载


ACF - Google Fonts Field

A field for Advanced Custom Fields (ACF) allowing users to select fonts from the Google Fonts suite.

This plugin creates a new ACF field that can be used to select fonts from the Google Fonts library using thier webfonts API.

A local copy of API results are included with the plugin, however, an Google Fonts API key is helpful to update the fonts list automatically.

Download this plugin here »

Field settings

Example of field setup.

Field preview

Example of field usage.

Return values

There are 4 returnable values for this field which include:

Type Description Example
Font family name Returns the full name of the selected font. Open Sans
Selected font variants Returns an array of selected font variants (if enabled) ['regular', 'italic', '400']
Selected font subsets Returns an array of selected font subsets (if enabled) ['latin', 'latin-ext', 'greek']
CSS import url A full url for the selected family, variants and subsets for including in CSS. https://fonts.googleapis.com/css?family=Mulish:300,500,200italic,300italic&display=swap
All (Array) An array including all of the above. *see below
  1. [
  2. 'family' => 'Open Sans',
  3. 'variants' => ['regular', 'italic', '400'],
  4. 'subsets' => ['latin', 'latin-ext', 'greek'],
  5. 'import' => 'https://fonts.googleapis.com/css?family=Open+Sans:300,500,200italic,300italic&display=swap'
  6. ]

Todo

  • Variants and subsets need to prefill with saved values.
  • Upgrade Google CSS API from v1 to v2.