fix font definitions

This commit is contained in:
2025-04-02 14:54:14 +05:00
parent 84f0caa0e4
commit a6897ccf15
4 changed files with 166 additions and 30 deletions

18
assets/css/custom.css Normal file
View File

@ -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 */
);
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 61 KiB

83
functions.php Normal file
View File

@ -0,0 +1,83 @@
<?php
function disable_default_patterns()
{
remove_theme_support('core-block-patterns');
}
add_action('after_setup_theme', 'disable_default_patterns');
// enqueue custom css on front-end and editor
function somosinfinitos_editor_css()
{
add_editor_style(get_theme_file_uri('/assets/css/custom.css'));
}
add_action('after_setup_theme', 'somosinfinitos_editor_css');
function somosinfinitos_frontend_css()
{
wp_enqueue_style('jett_css', get_theme_file_uri('/assets/css/custom.css'));
}
add_action('wp_enqueue_scripts', 'somosinfinitos_frontend_css');
// enable svg uploads
add_filter('wp_check_filetype_and_ext', function ($data, $file, $filename, $mimes) {
global $wp_version;
if ($wp_version !== '4.7.1') {
return $data;
}
$filetype = wp_check_filetype($filename, $mimes);
return [
'ext' => $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;
}

View File

@ -40,37 +40,61 @@
"fontFamily": "EB Garamond", "fontFamily": "EB Garamond",
"fontWeight": "400", "fontWeight": "400",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/eb-garamond/EBGaramond-Regular.ttf"] "src": ["file:./assets/fonts/eb-garamond/eb-garamond.woff2"]
}, },
{ {
"fontFamily": "EB Garamond", "fontFamily": "EB Garamond",
"fontWeight": "400", "fontWeight": "400",
"fontStyle": "italic", "fontStyle": "italic",
"src": ["file:./assets/fonts/eb-garamond/EBGaramond-Italic.ttf"] "src": ["file:./assets/fonts/eb-garamond/eb-garamond-italic.woff2"]
}, },
{ {
"fontFamily": "EB Garamond", "fontFamily": "EB Garamond",
"fontWeight": "500", "fontWeight": "500",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/eb-garamond/EBGaramond-Medium.ttf"] "src": ["file:./assets/fonts/eb-garamond/eb-garamond-medium.woff2"]
}, },
{ {
"fontFamily": "EB Garamond", "fontFamily": "EB Garamond",
"fontWeight": "500", "fontWeight": "500",
"fontStyle": "italic", "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", "fontFamily": "EB Garamond",
"fontWeight": "600", "fontWeight": "600",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/eb-garamond/EBGaramond-SemiBold.ttf"] "src": ["file:./assets/fonts/eb-garamond/eb-garamond-semibold.woff2"]
}, },
{ {
"fontFamily": "EB Garamond", "fontFamily": "EB Garamond",
"fontWeight": "600", "fontWeight": "600",
"fontStyle": "italic", "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", "fontFamily": "Jura",
"fontWeight": "300", "fontWeight": "300",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/jura/Jura-Light.ttf"] "src": ["file:./assets/fonts/jura/jura-light.woff2"]
}, },
{ {
"fontFamily": "Jura", "fontFamily": "Jura",
"fontWeight": "400", "fontWeight": "400",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/jura/Jura-Regular.ttf"] "src": ["file:./assets/fonts/jura/jura.woff2"]
}, },
{ {
"fontFamily": "Jura", "fontFamily": "Jura",
"fontWeight": "500", "fontWeight": "500",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/jura/Jura-Medium.ttf"] "src": ["file:./assets/fonts/jura/jura-medium.woff2"]
}, },
{ {
"fontFamily": "Jura", "fontFamily": "Jura",
"fontWeight": "600", "fontWeight": "600",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/jura/Jura-SemiBold.ttf"] "src": ["file:./assets/fonts/jura/jura-semibold.woff2"]
}, },
{ {
"fontFamily": "Jura", "fontFamily": "Jura",
"fontWeight": "700", "fontWeight": "700",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/jura/Jura-Bold.ttf"] "src": ["file:./assets/fonts/jura/jura-bold.woff2"]
} }
] ]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"slug": "sora", "slug": "sora",
"name": "Sora", "name": "sora",
"fontFace": [ "fontFace": [
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "100", "fontWeight": "100",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-Thin.ttf"] "src": ["file:./assets/fonts/sora/sora-thin.woff2"]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "200", "fontWeight": "200",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-ExtraLight.ttf"] "src": ["file:./assets/fonts/sora/sora-extralight.woff2"]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "300", "fontWeight": "300",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-Light.ttf"] "src": ["file:./assets/fonts/sora/sora-light.woff2"]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "400", "fontWeight": "400",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-Regular.ttf"] "src": ["file:./assets/fonts/sora/sora.woff2"]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "500", "fontWeight": "500",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-Medium.ttf"] "src": ["file:./assets/fonts/sora/sora-medium.woff2"]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "600", "fontWeight": "600",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-SemiBold.ttf"] "src": ["file:./assets/fonts/sora/sora-semibold.woff2"]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "700", "fontWeight": "700",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-Bold.ttf"] "src": ["file:./assets/fonts/sora/sora-bold.woff2"]
}, },
{ {
"fontFamily": "Sora", "fontFamily": "sora",
"fontWeight": "800", "fontWeight": "800",
"fontStyle": "normal", "fontStyle": "normal",
"src": ["file:./assets/fonts/sora/Sora-ExtraBold.ttf"] "src": ["file:./assets/fonts/sora/sora-extrabold.woff2"]
} }
] ]
} }
@ -176,7 +200,7 @@
}, },
{ {
"fluid": false, "fluid": false,
"name": "Medium", "name": "medium",
"size": "16px", "size": "16px",
"slug": "small" "slug": "small"
}, },