How to force a custom font to apply in wordpress OceanWP theme?

I ask for help to impose a custom font on my WordPress site, with the Ocean Wp theme (of which I have installed a child theme).

The chosen font is configured in style.css as follows:

@font-face {
    font-family: 'Noto-sans-JP-thin';
    src: url('fonts/notosansjp-thin-webfont.eot');
    src: url('fonts/notosansjp-thin-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/notosansjp-thin-webfont.woff2') format('woff2'), url('fonts/notosansjp-thin-webfont.woff') format('woff'), url('fonts/notosansjp-thin-webfont.ttf') format('truetype'), url('fonts/notosansjp-thin-webfont.svg#webfontthin-alphabetic') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Noto-sans-JP';
    src: url('fonts/notosansjp-regular-webfont.eot');
    src: url('fonts/notosansjp-regular-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/notosansjp-regular-webfont.woff2') format('woff2'), url('fonts/notosansjp-regular-webfont.woff') format('woff'), url('fonts/notosansjp-regular-webfont.ttf') format('truetype'), url('fonts/notosansjp-regular-webfont.svg#webfontregular-alphabetic') format('svg');
    font-weight: normal;
    font-style: normal;
}

I have no error in the console, the font files are well recognized. In functions.php :

 function ocean_add_custom_fonts() {
   return array('Noto-sans-JP-thin', 'Noto-sans-JP');
   }

I had followed this link. This allows me to have my 2 fonts in the theme’s typography, but when I choose them for the body text or the titles for example, nothing happens.

in the theme, in CSS customization:

body {
font-family: Noto-sans-JP-thin !important;
}
p, a {
 font-family: Noto-sans-JP-thin !important;
    font-weight: 100;
 }
h1, h2, h3, h4, h5, h6, article {
 font-family: Noto-sans-JP !important;
    font-weight: 400;
 }

On the other hand, very strange … When I copy a text from the site to a text editor, it is put in the correct font in the text editor …

site text
text editor

I really need help, I don’t understand the behavior at all. Cannot change the font, even when using other fonts offered … There is really something that totally blocks the writing in the theme.

Leave a Comment