Contourner les Google Fonts du thème Chaplin 2.6.7 sous WordPress 6.1.1
Le thème Chaplin (merci Anders Norén) intègre les fonts de google comme une dépendance, donc pour utiliser une font personnaliser...
$ vi wp-content/themes/chaplin-child/functions.php
function dc_remove_fonts( $deps ) {
if ( ( $key = array_search('chaplin-google-fonts', $deps ) ) !== false) {
unset( $deps[$key] );
}
return $deps;
}
add_filter( 'chaplin_css_dependencies', 'dc_remove_fonts', 10, 1 );
$ vi wp-content/themes/chaplin-child/ctc-style.css
/* CHARGER LA FONT KOLLECTIF */
@font-face {
font-family: 'KollektifRegular';
font-style: normal;
font-weight: normal;
src: url('/wp-content/themes/chaplin-child/fonts/Kollektif.woff') format('woff');
}
@font-face {
font-family: 'KollektifItalic';
font-style: normal;
font-weight: normal;
src: url('/wp-content/themes/chaplin-child/fonts/Kollektif-Italic.woff') format('woff');
}
@font-face {
font-family: 'KollektifBold';
font-style: normal;
font-weight: normal;
src: url('/wp-content/themes/chaplin-child/fonts/Kollektif-Bold.woff') format('woff');
}
@font-face {
font-family: 'KollektifBoldItalic';
font-style: normal;
font-weight: normal;
src: url('/wp-content/themes/chaplin-child/fonts/Kollektif-BoldItalic.woff') format('woff');
}
body, h1, h2, h3, h4, h5, h6, p {
font-family: "KollektifRegular", Arial, sans-serif;
}
Et ça marche
Source : https://wordpress.org/support/topic/google-fonts-locally-2/