如何在 function.php 文件中链接自定义字体

问题描述 投票:0回答:0

我正在尝试在我的 WordPress 开发主题中添加自定义字体,但我在如何添加它时遇到了致命错误

/// Register fonts.
    Wp_register_style('font-awesome', get_stylesheet_uri(), [], filemtime get_template_directory_uri().'/fonts/font-awesome-webfont.woff', [], false, 'all');
    wp_register_style('Naskh', get_stylesheet_uri(), [], filemtime get_template_directory_uri().'/fonts/naskh-webfont.woff', [], false, 'all');
    wp_register_style('Roboto', get_stylesheet_uri(), [], filemtime, get_template_directory_uri().'/fonts/roboto-webfont.woff', [], false, 'all');`


`/// Enqueue Fonts.
    wp_enqueue_style('font-awesome-webfont.woff');
    wp_enqueue_style('naskh-webfont.woff');
    wp_enqueue_style('roboto-webfont.woff');`

and in the css i add it like this

`--arabic-fonts:src='\\fonts\\naskh-webfont.woff';
--english-fonts:src='\\fonts\\roboto-webfont.woff';`

`[dir="rtl"] .container {font-family:var(--arabic-fonts);}
[dir="ltr"] .container {font-family:var(--english-fonts);}`

请帮助我谢谢您的回复我很感激

我尝试用 Google 搜索,但找不到任何可能的修复方法

这是我遇到的错误,抱歉

致命错误:未捕获错误:C:\xampp\htdocs\MyWebSite\wp-content hemes\Copper unctions.php:16 中未定义常量“filemtime”:#0 C:\xampp\htdocs\MyWebSite\wp-include

php html css wordpress fonts
© www.soinside.com 2019 - 2024. All rights reserved.