我正在尝试将html转换为wordpress。html中的代码是:
<script src="js/jquery.nicescroll.min.js"></script>
<script src="js/jquery.js"></script> ( jQuery v1.7.2 )
和内联脚本$(document).ready(
function() {
$("html").niceScroll();
}
); and much more.
在wordpress函数中。php,我添加了这个if ( ! function_exists( \'your_enqueue\' ) ) :
function your_enqueue(){
wp_enqueue_script(\' name \', get_template_directory_uri(). \'/script.js\' , array(\'jquery\')), \'1.0\', false);
}
endif;
add_action(\'wp_enqueue_scripts\', \'your_enqueue\');
我创建了一个新的。名为script的js文件。js并在其中添加了以下代码:<script src="js/jquery.nicescroll.min.js"></script>
$(document).ready(
function() {
$("html").niceScroll();
}
);
这样做对吗?这样行吗?Wordpress默认使用jQuery v1。7.2或必须在功能中重新进行一些编码。php