这是我的 functions.php 中的代码,请解释一下这段代码无法正常工作的原因
function themeslug_enqueue_script() {
wp_enqueue_script( 'jquery-js', get_template_directory_uri().'/js/jquery-1.6.js', false );
wp_enqueue_script( 'cufon-yui-js', get_template_directory_uri().'/js/cufon-yui.js', false );
wp_enqueue_script( 'cufon-replace-js', get_template_directory_uri(). '/js/cufon-replace.js', false );
wp_enqueue_script( 'NewsGoth_BT_400-js', get_template_directory_uri(). '/js/NewsGoth_BT_400.font.js', false );
wp_enqueue_script( 'jcarousellite-js', get_template_directory_uri().'/js/jcarousellite.js', false );
wp_enqueue_script( 'jquery.easing-js', get_template_directory_uri().'/js/jquery.easing.1.3.js', false );
wp_enqueue_script( 'mousewheel-js', get_template_directory_uri().'/js/jquery.mousewheel.js', false );
wp_enqueue_script( 'atooltip-js', get_template_directory_uri().'/js/atooltip.jquery.js', false );
}
add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' );
?>
这是我的标题以及如何包含在
中<script src="<?php echo get_template_directory_uri();?>/js/jquery-1.6.js" ></script>
<script src="<?php echo get_template_directory_uri();?>/js/cufon-yui.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/cufon-replace.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/NewsGoth_BT_400.font.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/NewsGoth_BT_700.font.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/jcarousellite.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/jquery.easing.1.3.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/jquery.mousewheel.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/atooltip.jquery.js"></script>
答案 0 :(得分:0)
Option #1. Upload a custom Javascript file
Save your custom JavaScript code into a file with the .js format.
Upload it into your site to this folder: wp-content/themes/your-theme/js/
Go to Settings > Header and Footer Scripts.
https://www.ostraining.com/blog/wordpress/custom-js/