我对样式和js函数有问题,它没有显示。这是我的function.php,我已经在header.php和wp_footer中添加了wp_head,并且没有显示stlye。
<?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');
?>
发布于 2022-05-30 18:56:31
正如布鲁诺指出的,将文件重命名为functions.php并使用以下代码:我删除了错误的语法,并添加了正确的语法来调用脚注中的脚本。
<?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');
?>https://stackoverflow.com/questions/72438749
复制相似问题