【问题标题】:Some issues with js/jQuery in wordpress on xampp [closed]xampp上wordpress中js/jQuery的一些问题[关闭]
【发布时间】:2019-03-18 17:59:24
【问题描述】:

我正在使用引导程序来结束某个站点。我需要为 wordpress 准备它。我做到了 60%,但我不能做一件事。我的 jquery/js 函数不起作用。诸如:弹出窗口、平滑滚动等等。有人可以帮我吗?

add_theme_support('post-thumbnails');

function b2w_theme_styles(){

    wp_enqueue_style('boostrap_css', get_template_directory_uri() . '/css/bootstrap.min.css');
    wp_enqueue_style('xtyle_css', get_template_directory_uri() . '/style.css');
    wp_enqueue_style('simple_line_icons',get_template_directory_uri() . '/vendor/simple-line-icons/css/simple-line-icons.css');
    wp_enqueue_style('popup_css',get_template_directory_uri() . '/vendor/magnific-popup/magnific-popup.css');
}

add_action('wp_enqueue_scripts', 'b2w_theme_styles');

function b2w_theme_js(){
    wp_enqueuue_script( 'bootstrap.js',get_template_directory_uri() .'/wp-content/themes/Atut/js/creative.min.js', array('jquery'), null,true);
    wp_enqueuue_script( 'bootstrap_bundle.js',get_template_directory_uri() .'/wp-content/themes/Atut/js/bootstrap.bundle.min.js', array('jquery'), null,true);
    wp_enqueuue_script( 'jquery_min.js',get_template_directory_uri() .'/vendor/jquery/jquery.min.js', array('jquery'), '3.2.1',true);
    wp_enqueuue_script( 'bootstrap_bundle_min.js',get_template_directory_uri() .'/vendor/bootstrap/js/bootstrap.bundle.min.js', array('jquery'),null,true);
    wp_enqueuue_script( 'scrollreveal_min.js',get_template_directory_uri() .'/vendor/scrollreveal/scrollreveal.min.js', array('jquery'),'3.2.1',true);
    wp_enqueuue_script( 'jquery_magnific-popup_min.js',get_template_directory_uri(). '/vendor/magnific-popup/jquery.magnific-popup.min.js', array('jquery'),null,true);
    wp_enqueuue_script( 'easing_js',get_template_directory_uri() .'/vendor/jquery-easing/jquery.easing.min.js', array('jquery'), null,true);

}

add_action('wp_enqueue_scripts', 'b2w_theme_styles');

function shapeSpace_include_custom_jquery() {

	wp_deregister_script('jquery');
	wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js', array(), null, true);

}
add_action('wp_enqueue_scripts', 'shapeSpace_include_custom_jquery');

【问题讨论】:

标签: javascript jquery wordpress xampp bootstrap-4


【解决方案1】:

您的代码有重复的add_action

add_action('wp_enqueue_scripts', 'b2w_theme_styles');

将其中一个add_action 更改为:

add_action('wp_enqueue_scripts', 'b2w_theme_js');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-12
    • 1970-01-01
    • 1970-01-01
    • 2020-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多