<?php
function ju_enqueue()
{
register_style(handle:'ju_google_fonts', src:'http://fonts.googleapis.com/css?family=Lato:300,400,400italic,600,700|Raleway:300,400,500,600,700|Crete+Round:400italic');
wp_register_style(handle:'ju_bootstrap', src:get_template_directory_uri() .'/assets/css/bootstrap.css');
wp_register_style(handle:'ju_style', src:get_template_directory_uri() .'/assets/css/style.css');
wp_register_style(handle:'ju_dark', src:get_template_directory_uri() .'/assets/css/dark.css');
wp_register_style(handle:'ju_font_icons', src:get_template_directory_uri() .'/assets/css/font-icons.css');
wp_register_style(handle:'ju_animate', src:get_template_directory_uri() .'/assets/css/animate.css');
wp_register_style(handle:'ju_magnific_popup', src:get_template_directory_uri() .'/assets/css/magnific-popup.css');
wp_register_style(handle:'ju_responsive', src:get_template_directory_uri() .'/assets/css/responsive.css');
wp_register_style(handle:'ju_custom', src:get_template_directory_uri() .'/assets/css/custom.css');
wp_enqueue_style(handle:'ju_google_fonts');
wp_enqueue_style(handle:'ju_bootstrap');
wp_enqueue_style(handle:'ju_style');
wp_enqueue_style(handle:'ju_dark');
wp_enqueue_style(handle:'ju_font_icons');
wp_enqueue_style(handle:'ju_animate');
wp_enqueue_style(handle:'ju_magnific_popup');
wp_enqueue_style(handle:'ju_responsive');
wp_enqueue_style(handle:'ju_custom');
}
该代码错误的是什么......我收到此错误
解析错误:语法错误,意外&#39;:&#39;,期待&#39;,&#39;或者&#39;)&#39;在第5行的C:\ xampp \ htdocs \ wordpress \ wp-content \ themes \ udemy \ includes \ front \ enqueue.php
答案 0 :(得分:0)
在函数调用中尝试不使用handle:
和src:
function ju_enqueue()
{
register_style('ju_google_fonts', 'http://fonts.googleapis.com/css?family=Lato:300,400,400italic,600,700|Raleway:300,400,500,600,700|Crete+Round:400italic');
wp_register_style('ju_bootstrap', get_template_directory_uri() .'/assets/css/bootstrap.css');
wp_register_style('ju_style', get_template_directory_uri() .'/assets/css/style.css');
wp_register_style('ju_dark', get_template_directory_uri() .'/assets/css/dark.css');
wp_register_style('ju_font_icons', get_template_directory_uri() .'/assets/css/font-icons.css');
wp_register_style('ju_animate', get_template_directory_uri() .'/assets/css/animate.css');
wp_register_style('ju_magnific_popup', get_template_directory_uri() .'/assets/css/magnific-popup.css');
wp_register_style('ju_responsive', get_template_directory_uri() .'/assets/css/responsive.css');
wp_register_style('ju_custom', get_template_directory_uri() .'/assets/css/custom.css');
wp_enqueue_style('ju_google_fonts');
wp_enqueue_style('ju_bootstrap');
wp_enqueue_style('ju_style');
wp_enqueue_style('ju_dark');
wp_enqueue_style('ju_font_icons');
wp_enqueue_style('ju_animate');
wp_enqueue_style('ju_magnific_popup');
wp_enqueue_style('ju_responsive');
wp_enqueue_style('ju_custom');
}
您还应该查看此https://codex.wordpress.org/Function_Reference/wp_register_style