PHP code example of automattic / jetpack-google-fonts-provider

1. Go to this page and download the library: Download automattic/jetpack-google-fonts-provider 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/ */

    

automattic / jetpack-google-fonts-provider example snippets


wp_register_webfont_provider( 'google-fonts', '\Automattic\Jetpack\Fonts\Google_Fonts_Provider' );

wp_register_webfont(
		array(
			'font-family' => 'Lato',
			'provider'    => 'google-fonts',
		),
);

add_filter( 'wp_resource_hints', '\Automattic\Jetpack\Fonts\Utils::font_source_resource_hint', 10, 2 );