From c5964805d5dfcb41e005ef43a231a8e8ad86ec17 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Thu, 8 Feb 2024 00:14:57 +0100 Subject: [PATCH] Reflect font selection on settings page --- fonts/helvetica-neue/font.json | 2 +- .../settings/_settings_page_fonts.php | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fonts/helvetica-neue/font.json b/fonts/helvetica-neue/font.json index 393069d0..bbcd8c95 100644 --- a/fonts/helvetica-neue/font.json +++ b/fonts/helvetica-neue/font.json @@ -10,7 +10,7 @@ "styles": ["normal", "italic"], "weights": [100, 200, 300, 400, 500, 700, 900], "charsets": ["latin"], - "formats": [], + "formats": ["ttf"], "about": "Helvetica, also known by its original name Neue Haas Grotesk, is a widely used sans-serif typeface developed in 1957 by Swiss typeface designer Max Miedinger and Eduard Hoffmann. Helvetica Neue is a reworking of the typeface with a more structurally unified set of heights and widths. Other changes include improved legibility, heavier punctuation marks, and increased spacing in the numbers.", "note": "This is a font provided by the operating system and not always available.", "sources": { diff --git a/includes/functions/settings/_settings_page_fonts.php b/includes/functions/settings/_settings_page_fonts.php index 0774153b..e2c3140e 100644 --- a/includes/functions/settings/_settings_page_fonts.php +++ b/includes/functions/settings/_settings_page_fonts.php @@ -12,9 +12,9 @@ // Setup $fonts = fictioneer_get_font_data(); -// $primary_font = get_theme_mod( 'primary_font_family_value', 'Open Sans' ); -// $secondary_font = get_theme_mod( 'secondary_font_family_value', 'Lato' ); -// $heading_font = get_theme_mod( 'heading_font_family_value', 'Open Sans' ); +$primary_font = get_theme_mod( 'primary_font_family_value', 'Open Sans' ); +$secondary_font = get_theme_mod( 'secondary_font_family_value', 'Lato' ); +$heading_font = get_theme_mod( 'heading_font_family_value', 'Open Sans' ); ?> @@ -67,6 +67,18 @@ $fonts = fictioneer_get_font_data(); if ( ! empty( $version ) ) { printf( _x( ' (v%s)', 'Settings font card.', 'fictioneer' ), $version ); } + + if ( $primary_font === $font['family'] ) { + _ex( ' — Primary Font', 'Settings font card.', 'fictioneer' ); + } + + if ( $secondary_font === $font['family'] ) { + _ex( ' — Secondary Font', 'Settings font card.', 'fictioneer' ); + } + + if ( $heading_font === $font['family'] ) { + _ex( ' — Heading Font', 'Settings font card.', 'fictioneer' ); + } ?>