Wood Chen

Add a Custom Font to the Wordpress Neve Theme Customizer

0 comments141 views0 words

This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文

//Add a custom font to the neve theme
function add_custom_font() { 
	$font_path_ttf = get_stylesheet_directory_uri() . '/fonts/BionicKidSimpleSlanted.ttf';
	?>
	<style type="text/css">
	@font-face {
		font-family: 'BionicKidSimpleSlanted';
		src: url( <?php  echo esc_url( $font_path_ttf ); ?>)  format('truetype');
	}
	</style>
	<?php
}
add_action( 'wp_head', 'add_custom_font' );
add_action( 'customize_controls_print_styles', 'add_custom_font' );

function add_custom_fonts( $localized_data ) {
	$localized_data['fonts']['Custom'][] = 'BionicKidSimpleSlanted';
	return $localized_data;
}
add_filter( 'neve_react_controls_localization', 'add_custom_fonts' );

Last updated 2024-02-29

Related posts

Comments 0