From 52dda9c7a90fb7913e1d0ebf46bbc678c0b7d27d Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Thu, 22 Feb 2024 23:58:53 -0300 Subject: [PATCH] accommodate changes from core 6.5 beta 2 --- collection.json | 20 -------------------- index.php | 33 +++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/collection.json b/collection.json index c93c49a..f27bd12 100644 --- a/collection.json +++ b/collection.json @@ -1,25 +1,5 @@ { "$schema": "https://schemas.wp.org/trunk/font-collection.json", - "name": "Modern Fonts Stacks", - "description": "Stacks of modern systems fonts, not font face assets needed. The look will vary on each system.", - "categories": [ - { - "slug": "sans-serif", - "name": "Sans Serif" - }, - { - "slug": "serif", - "name": "Serif" - }, - { - "slug": "monospace", - "name": "Monospace" - }, - { - "slug": "handwriting", - "name": "Handwriting" - } - ], "font_families": [ { "font_family_settings": { diff --git a/index.php b/index.php index 7ff8e76..cc0a61f 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ Plugin Name: Modern Fonts Stacks Plugin URI: https://github.com/matiasbenedetto/modern-fonts-stacks-for-wp-font-library/ Description: Add a font collection to your WordPress Font Library. -Version: 0.0.4 +Version: 0.0.5 Author: Matias Benedetto Author URI: https://wordpress.org/ License: GPLv2 or later @@ -11,11 +11,36 @@ */ if ( function_exists( 'wp_register_font_collection' ) ) { - function register_modern_fonts_stacks() { - wp_register_font_collection ( 'modern-fonts-stacks', path_join( __DIR__, 'collection.json' ) ); + $categories = array( + array( + "slug" => "sans-serif", + "name" => "Sans Serif" + ), + array( + "slug" => "serif", + "name" => "Serif" + ), + array( + "slug" => "monospace", + "name" => "Monospace" + ), + array( + "slug" => "handwriting", + "name" => "Handwriting" + ) + ); + + $font_collection = array( + 'name' => __( 'Modern Fonts Stacks' ), + 'description' => __( 'Stacks of modern systems fonts, not font face assets needed. The look will vary on each system.' ), + 'categories' => $categories, + 'font_families' => path_join( __DIR__, 'collection.json' ), + ); + + wp_register_font_collection( 'modern-fonts-stacks', $font_collection ); } add_action( 'init', 'register_modern_fonts_stacks' ); - } +