Wordpress Neve主题 添加自定义字体到“主题自定义”处

Wordpress Neve主题 添加自定义字体到“主题自定义”处

woodchen
2023-03-03 / 0 评论 / 6 阅读 / 正在检测是否收录...
//neve主题添加自定义字体
function add_custom_font() { 
    $font_path_ttf = 'https://cdn.xxx.xxx/fonts.woff2';
    ?>
     <style type="text/css">
    @font-face {
        font-family: '字体名字';
        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'][] = '字体名字';
     return $localized_data;
 }
 add_filter( 'neve_react_controls_localization', 'add_custom_fonts' );
0

评论 (0)

取消