2017-07-14 9 views
0

これはfunction.phpで追加している機能ですが、機能しません。このコードに間違いはありますか?WordPressのこの機能に問題があり、テーマにカスタムのスクリプトとスタイルを適用できますか?

function custom_scripts_css_with_jquery() 
{ 

    //wp_register_script('Bootstrap_min_js','//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'); 
    wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'); 
    wp_register_script('select2jquery', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js'); 
    wp_register_style('select2mincss', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css'); 

    // For either a plugin or a theme, you can then enqueue the style: 
    wp_enqueue_script('select2jquery'); 
    wp_enqueue_script('jquery'); 
    wp_enqueue_style('select2mincss'); 
    //wp_enqueue_script('Bootstrap_min_js'); 
} 
add_action('wp_enqueue_scripts', 'custom_scripts_css_with_jquery'); 

答えて

0

使用beloe機能

 function custom_scripts_css_with_jquery() 
{ 
    // Deregister the included library 
    //wp_deregister_script('jquery'); 

    // Register the library again from Google's CDN 
    wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js', array(), null, false); 
    wp_register_script('select2jquery', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js', array(), null, false); 
    // Register the style like this for a theme: 
    wp_register_style('select2mincss', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css', array(), '4.0.3', 'all'); 

    // For either a plugin or a theme, you can then enqueue the style: 
    wp_enqueue_style('select2mincss'); 


} 
add_action('wp_enqueue_scripts', 'custom_scripts_css_with_jquery'); 
+0

私は今、更新され、問題のある更新されたコードであることを試してみました。しかし、それはまだ動作していません@ Shital Marakana – Vishal

関連する問題