1. Go to this page and download the library: Download kaiseki/wp-font-loader library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kaiseki / wp-font-loader example snippets
use Kaiseki\WordPress\FontLoader\FontFaceInterface;
use Kaiseki\WordPress\FontLoader\FontFaceRegistry;
use Kaiseki\WordPress\FontLoader\FontFaceFilter\PreloadFilter;
use Kaiseki\WordPress\FontLoader\FontFaceFilter\VariableFontFilter;
return [
'font_loader' => [
// FontFaceFilterInterface instances/class-strings applied to every parsed face.
'filter' => [
PreloadFilter::class,
new VariableFontFilter(weight: '100 900'),
],
'path_loader' => [
// Directories scanned for font files.
'paths' => [
get_stylesheet_directory() . '/assets/fonts',
],
// Where the @font-face CSS is printed.
'locations' => [
FontFaceInterface::FRONTEND,
FontFaceInterface::BACKEND,
FontFaceInterface::LOGIN,
],
'display' => 'swap',
'without_domain' => false,
'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.