首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我对wordpress中的function.php有一个问题

我对wordpress中的function.php有一个问题
EN

Stack Overflow用户
提问于 2022-05-30 18:37:50
回答 1查看 35关注 0票数 0

我对样式和js函数有问题,它没有显示。这是我的function.php,我已经在header.php和wp_footer中添加了wp_head,并且没有显示stlye。

代码语言:javascript
复制
<?php 
function gt_setup(){

wp_enqueue_style('google-fonts','//fonts.googleapis.com/css2?family=Raleway:wght@100&family=Roboto:wght@100&display=swap');

wp_enqueue_style('fontawesome','//use.fontawesome.com/releases/v5.8.1/css/all.css');
wp_enqueue_style('style',get_stylesheet_uri(),NUll,microtime(),all);
wp_enqueue_script("main",get_theme_file_uri('js/main.js'),true);
}

add_action('wp_enqueue_scripts','gt_setup');
?>

EN

回答 1

Stack Overflow用户

发布于 2022-05-30 18:56:31

正如布鲁诺指出的,将文件重命名为functions.php并使用以下代码:我删除了错误的语法,并添加了正确的语法来调用脚注中的脚本。

代码语言:javascript
复制
<?php
function gt_setup(){

    wp_enqueue_style('google-fonts','//fonts.googleapis.com/css2?family=Raleway:wght@100&family=Roboto:wght@100&display=swap');

    wp_enqueue_style('fontawesome','//use.fontawesome.com/releases/v5.8.1/css/all.css');
    wp_enqueue_style('style',get_stylesheet_uri(),NUll,microtime());
    wp_enqueue_script("main",get_theme_file_uri('js/main.js'),[],'',true);
}

add_action('wp_enqueue_scripts','gt_setup');
?>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72438749

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档