Adding Adobe Fonts to GeneratePress

black gaming keyboard
Photo by Aidan Granberry on Unsplash

GeneratePress is a great WordPress theme, and its blocks are super powerful, albeit incredibly simple.

While developing a site, I wanted to use Adobe Fonts with the GeneratePress customizer. I use the following plugin:

Here is the code I used to add Adobe Fonts to the GeneratePress customizer.

/**
 * Compatibility with: https://wordpress.org/plugins/custom-typekit-fonts/
 * Would be nice to be able to categorize fonts: https://docs.generatepress.com/article/generate_typography_default_fonts/
 */
add_filter( 'generate_typography_default_fonts', 'mr_custom_add_typekit_fonts' );
function mr_custom_add_typekit_fonts( $fonts ) {
	// Add Typekit Fonts.
	if ( defined( 'CUSTOM_TYPEKIT_FONTS_FILE' ) ) {
		$adobe_fonts = get_option( 'custom-typekit-fonts', array() );
		if ( isset( $adobe_fonts['custom-typekit-font-details'] ) ) {
			foreach ( $adobe_fonts['custom-typekit-font-details'] as $font_name => $font_details ) {
				$fonts[] = $font_name;
			}
		}
	}
	return $fonts;
}Code language: PHP (php)
Ronald Huereca
Ronald Huereca

Ronald Huereca

Ronald has been part of the WordPress community since 2006, starting off writing and eventually diving into WordPress plugin development and writing tutorials and opinionated pieces.

No stranger to controversy and opinionated takes on tough topics, Ronald writes honestly when he covers a topic.

Ronald Huereca
MediaRon - Ronald Huereca

Ronald created MediaRon in 2011 and has more than fifteen years of releasing free and paid WordPress plugins.

Quick Links

Say Hi