Contourner les Google Fonts du thème Chaplin 2.6.7 sous WordPress 6.1.1

Publié le - Modifié le 04 janvier 2023 | Aucun commentaire

Classé dans : Astuce, Personnalisation en 10 min. | Mots clés : WordPress, CSS

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 smiley

Source : https://wordpress.org/support/topic/google-fonts-locally-2/

Écrire un commentaire

Quelle est le sixième caractère du mot pdfezlj ?

Fil RSS des commentaires de cet article