From a6897ccf15c1dbb200768fd8dbf8091fd60c52ae Mon Sep 17 00:00:00 2001 From: Aadil Ayub Date: Wed, 2 Apr 2025 14:54:14 +0500 Subject: [PATCH] fix font definitions --- assets/css/custom.css | 18 ++++++++ assets/images/header-logo.svg | 11 +++++ functions.php | 83 ++++++++++++++++++++++++++++++++++ theme.json | 84 ++++++++++++++++++++++------------- 4 files changed, 166 insertions(+), 30 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 assets/images/header-logo.svg create mode 100644 functions.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..8a39747 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,18 @@ +html { + background: var(--wp--preset--color--background); +} + +body { + background: radial-gradient( + 50% 50% /* The size of the gradient: 50% wide, 50% tall */ + at 50% 65%, /* Position of the center point: centered horizontally and 65% down */ + rgba(142, 154, 236, 0.4) 0%, /* Starting color: blue-purple at 40% opacity, begins at center */ + rgba(142, 154, 236, 0) 100% /* Ending color: same blue-purple but fully transparent, ends at edge */ + ), + radial-gradient( + 50% 50% /* The size of the gradient: 50% wide, 50% tall */ + at 50% 85%, /* Position of the center point: centered horizontally and 85% down */ + rgba(142, 154, 236, 0.4) 0%, /* Starting color: blue-purple at 40% opacity, begins at center */ + rgba(142, 154, 236, 0) 100% /* Ending color: same blue-purple but fully transparent, ends at edge */ + ); +} diff --git a/assets/images/header-logo.svg b/assets/images/header-logo.svg new file mode 100644 index 0000000..173c4c1 --- /dev/null +++ b/assets/images/header-logo.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..0dcaa81 --- /dev/null +++ b/functions.php @@ -0,0 +1,83 @@ + $filetype['ext'], + 'type' => $filetype['type'], + 'proper_filename' => $data['proper_filename'] + ]; +}, 10, 4); +function cc_mime_types($mimes) +{ + $mimes['svg'] = 'image/svg+xml'; + return $mimes; +} +add_filter('upload_mimes', 'cc_mime_types'); + +// remove default woocommerce fonts +add_filter('wp_theme_json_data_theme', 'disable_inter_font', 100); +function disable_inter_font($theme_json) +{ + $theme_data = $theme_json->get_data(); + $font_data = $theme_data['settings']['typography']['fontFamilies']['theme'] ?? array(); + + // The font name to be removed + $font_names = ['Inter', 'Cardo']; + $font_names_total = 2; + $font_names_found = 0; + + // Check if 'Inter' font exists + foreach ($font_data as $font_key => $font) { + if (isset($font['name']) && in_array($font['name'], $font_names)) { + // Increment found font names + $font_names_found++; + + // Remove the font + unset($font_data[$font_key]); + + // Update font data + $theme_json->update_with(array( + 'version' => 1, + 'settings' => array( + 'typography' => array( + 'fontFamilies' => array( + 'theme' => $font_data, + ), + ), + ), + )); + if ($font_names_found === $font_names_total) { + break; + } + } + } + return $theme_json; +} diff --git a/theme.json b/theme.json index e6ef915..57e99d6 100644 --- a/theme.json +++ b/theme.json @@ -40,37 +40,61 @@ "fontFamily": "EB Garamond", "fontWeight": "400", "fontStyle": "normal", - "src": ["file:./assets/fonts/eb-garamond/EBGaramond-Regular.ttf"] + "src": ["file:./assets/fonts/eb-garamond/eb-garamond.woff2"] }, { "fontFamily": "EB Garamond", "fontWeight": "400", "fontStyle": "italic", - "src": ["file:./assets/fonts/eb-garamond/EBGaramond-Italic.ttf"] + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-italic.woff2"] }, { "fontFamily": "EB Garamond", "fontWeight": "500", "fontStyle": "normal", - "src": ["file:./assets/fonts/eb-garamond/EBGaramond-Medium.ttf"] + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-medium.woff2"] }, { "fontFamily": "EB Garamond", "fontWeight": "500", "fontStyle": "italic", - "src": ["file:./assets/fonts/eb-garamond/EBGaramond-MediumItalic.ttf"] + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-medium-italic.woff2"] }, { "fontFamily": "EB Garamond", "fontWeight": "600", "fontStyle": "normal", - "src": ["file:./assets/fonts/eb-garamond/EBGaramond-SemiBold.ttf"] + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-semibold.woff2"] }, { "fontFamily": "EB Garamond", "fontWeight": "600", "fontStyle": "italic", - "src": ["file:./assets/fonts/eb-garamond/EBGaramond-SemiBoldItalic.ttf"] + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-semibold-italic.woff2"] + }, + { + "fontFamily": "EB Garamond", + "fontWeight": "700", + "fontStyle": "normal", + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-bold.woff2"] + }, + { + "fontFamily": "EB Garamond", + "fontWeight": "700", + "fontStyle": "italic", + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-bold-italic.woff2"] + }, + { + "fontFamily": "EB Garamond", + "fontWeight": "800", + "fontStyle": "normal", + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-extrabold.woff2"] + }, + { + "fontFamily": "EB Garamond", + "fontWeight": "800", + "fontStyle": "italic", + "src": ["file:./assets/fonts/eb-garamond/eb-garamond-extrabold-italic.woff2"] } ] }, @@ -83,86 +107,86 @@ "fontFamily": "Jura", "fontWeight": "300", "fontStyle": "normal", - "src": ["file:./assets/fonts/jura/Jura-Light.ttf"] + "src": ["file:./assets/fonts/jura/jura-light.woff2"] }, { "fontFamily": "Jura", "fontWeight": "400", "fontStyle": "normal", - "src": ["file:./assets/fonts/jura/Jura-Regular.ttf"] + "src": ["file:./assets/fonts/jura/jura.woff2"] }, { "fontFamily": "Jura", "fontWeight": "500", "fontStyle": "normal", - "src": ["file:./assets/fonts/jura/Jura-Medium.ttf"] + "src": ["file:./assets/fonts/jura/jura-medium.woff2"] }, { "fontFamily": "Jura", "fontWeight": "600", "fontStyle": "normal", - "src": ["file:./assets/fonts/jura/Jura-SemiBold.ttf"] + "src": ["file:./assets/fonts/jura/jura-semibold.woff2"] }, { "fontFamily": "Jura", "fontWeight": "700", "fontStyle": "normal", - "src": ["file:./assets/fonts/jura/Jura-Bold.ttf"] + "src": ["file:./assets/fonts/jura/jura-bold.woff2"] } ] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "slug": "sora", - "name": "Sora", + "name": "sora", "fontFace": [ { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "100", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-Thin.ttf"] + "src": ["file:./assets/fonts/sora/sora-thin.woff2"] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "200", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-ExtraLight.ttf"] + "src": ["file:./assets/fonts/sora/sora-extralight.woff2"] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "300", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-Light.ttf"] + "src": ["file:./assets/fonts/sora/sora-light.woff2"] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "400", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-Regular.ttf"] + "src": ["file:./assets/fonts/sora/sora.woff2"] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "500", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-Medium.ttf"] + "src": ["file:./assets/fonts/sora/sora-medium.woff2"] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "600", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-SemiBold.ttf"] + "src": ["file:./assets/fonts/sora/sora-semibold.woff2"] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "700", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-Bold.ttf"] + "src": ["file:./assets/fonts/sora/sora-bold.woff2"] }, { - "fontFamily": "Sora", + "fontFamily": "sora", "fontWeight": "800", "fontStyle": "normal", - "src": ["file:./assets/fonts/sora/Sora-ExtraBold.ttf"] + "src": ["file:./assets/fonts/sora/sora-extrabold.woff2"] } ] } @@ -176,7 +200,7 @@ }, { "fluid": false, - "name": "Medium", + "name": "medium", "size": "16px", "slug": "small" },