mirror of
https://github.com/WenPai-org/wpfonts.git
synced 2025-08-03 19:19:52 +08:00
Update wpfonts.php
This commit is contained in:
parent
58b1ba2050
commit
ef1a80114c
1 changed files with 41 additions and 43 deletions
84
wpfonts.php
84
wpfonts.php
|
@ -1,79 +1,77 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Plugin Name: WPFonts
|
* Plugin Name: WPFonts
|
||||||
* Plugin URI: https://wenpai.org/plugins/wpfonts
|
* Plugin URI: https://wenpai.org/plugins/wpfonts
|
||||||
* Description: Add optimized system font stacks for Chinese, English, Japanese, and Korean to your WordPress Font Library.
|
* Description: Add optimized system font stacks for Chinese, English, Japanese, and Korean to your WordPress Font Library.
|
||||||
* Version: 1.1.0
|
* Version: 1.1.0
|
||||||
* Author: WPFonts.com
|
* Author: WPFonts.com
|
||||||
* Author URI: https://wpfonts.com
|
* Author URI: https://wpfonts.com
|
||||||
* Network: true
|
* Network: true
|
||||||
* License: GPL v2 or later
|
* License: GPL v2 or later
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
* Text Domain: wpfonts
|
* Text Domain: wpfonts
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Load text domain
|
// Load text domain
|
||||||
function wp_fonts_text_domain() {
|
function wp_fonts_load_textdomain() {
|
||||||
load_plugin_textdomain('wp-fonts', false, dirname(plugin_basename(__FILE__)) . '/languages');
|
load_plugin_textdomain('wpfonts', false, dirname(plugin_basename(__FILE__)) . '/languages');
|
||||||
}
|
}
|
||||||
add_action('init', 'wp_fonts_text_domain');
|
add_action('plugins_loaded', 'wp_fonts_load_textdomain');
|
||||||
|
|
||||||
// Register Font Collection
|
// Register Font Collection
|
||||||
if ( function_exists( 'wp_register_font_collection' ) ) {
|
if (function_exists('wp_register_font_collection')) {
|
||||||
function wenpai_register_wp_fonts() {
|
function wp_fonts_register_collections() {
|
||||||
$categories = array(
|
$categories = array(
|
||||||
array(
|
array(
|
||||||
'slug' => 'sans-serif',
|
'slug' => 'sans-serif',
|
||||||
'name' => __('Sans Serif', 'wpfonts' )
|
'name' => __('Sans Serif', 'wpfonts')
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'slug' => 'serif',
|
'slug' => 'serif',
|
||||||
'name' => __('Serif', 'wpfonts' )
|
'name' => __('Serif', 'wpfonts')
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'slug' => 'monospace',
|
'slug' => 'monospace',
|
||||||
'name' => __('Monospace', 'wpfonts' )
|
'name' => __('Monospace', 'wpfonts')
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'slug' => 'handwriting',
|
'slug' => 'handwriting',
|
||||||
'name' => __('Handwriting', 'wpfonts' )
|
'name' => __('Handwriting', 'wpfonts')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$font_collection_cn = array(
|
// Chinese Font Collection
|
||||||
|
wp_register_font_collection('wp-fonts-stacks-cn', array(
|
||||||
'name' => __('Chinese', 'wpfonts'),
|
'name' => __('Chinese', 'wpfonts'),
|
||||||
'description' => __('Cross-platform Chinese system font stacks. Automatically adapt to Windows/macOS/Linux fonts.', 'wpfonts'),
|
'description' => __('Cross-platform Chinese system font stacks. Automatically adapt to Windows/macOS/Linux fonts.', 'wpfonts'),
|
||||||
'categories' => $categories,
|
'categories' => $categories,
|
||||||
'font_families' => path_join(__DIR__, 'collection/chinese.json'),
|
'font_families' => path_join(__DIR__, 'collection/chinese.json'),
|
||||||
);
|
));
|
||||||
wp_register_font_collection('wp-fonts-stacks-cn', $font_collection_cn);
|
|
||||||
|
|
||||||
$font_collection_en = array(
|
// English Font Collection
|
||||||
|
wp_register_font_collection('wp-fonts-stacks-en', array(
|
||||||
'name' => __('English', 'wpfonts'),
|
'name' => __('English', 'wpfonts'),
|
||||||
'description' => __('Stacks of modern systems fonts, no font files needed. The look will vary on each system.', 'wpfonts'),
|
'description' => __('Stacks of modern system fonts, no font files needed. The look will vary on each system.', 'wpfonts'),
|
||||||
'categories' => $categories,
|
'categories' => $categories,
|
||||||
'font_families' => path_join(__DIR__, 'collection/english.json'),
|
'font_families' => path_join(__DIR__, 'collection/english.json'),
|
||||||
);
|
));
|
||||||
wp_register_font_collection('wp-fonts-stacks-en', $font_collection_en);
|
|
||||||
|
|
||||||
$font_collection_jp = array(
|
// Japanese Font Collection
|
||||||
'name' => __('Japanese', 'wpfonts'),
|
wp_register_font_collection('wp-fonts-stacks-jp', array(
|
||||||
'description' => __('Japanese system font stacks with optimized kana rendering', 'wpfonts'),
|
'name' => __('Japanese', 'wpfonts'),
|
||||||
'categories' => $categories,
|
'description' => __('Japanese system font stacks with optimized kana rendering.', 'wpfonts'),
|
||||||
|
'categories' => $categories,
|
||||||
'font_families' => path_join(__DIR__, 'collection/japanese.json'),
|
'font_families' => path_join(__DIR__, 'collection/japanese.json'),
|
||||||
);
|
));
|
||||||
wp_register_font_collection('wp-fonts-stacks-jp', $font_collection_jp);
|
|
||||||
|
|
||||||
$font_collection_kr = array(
|
// Korean Font Collection
|
||||||
'name' => __('Korean', 'wpfonts'),
|
wp_register_font_collection('wp-fonts-stacks-kr', array(
|
||||||
'description' => __('Hangul-optimized font stacks for Korean content', 'wpfonts'),
|
'name' => __('Korean', 'wpfonts'),
|
||||||
'categories' => $categories,
|
'description' => __('Hangul-optimized font stacks for Korean content.', 'wpfonts'),
|
||||||
|
'categories' => $categories,
|
||||||
'font_families' => path_join(__DIR__, 'collection/korean.json'),
|
'font_families' => path_join(__DIR__, 'collection/korean.json'),
|
||||||
);
|
));
|
||||||
wp_register_font_collection('wp-fonts-stacks-kr', $font_collection_kr);
|
|
||||||
}
|
}
|
||||||
|
add_action('init', 'wp_fonts_register_collections');
|
||||||
add_action('init', 'wenpai_register_wp_fonts');
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue