問題
WordPress化を進めていると、HTMLではきちんと動いていたjQueryが動いていない??
いろいろと検証を進めていくと、どうも、WordPressの標準jQueryに置き換えたことが原因になっていることが判明
解決
元のjQueryの読み込みができるように、funcctions.phpを変更
【変更前】
function_sample_enqueue_scripts() {
wp_enqueue_script('jquery'); ← ここの標準jQueryが原因!
}
add_action('wp_enqueue_scripts', 'sample_enqueue_scripts');
【変更後】 function_sample_enqueue_scripts() { wp_deregister_script('jquery'); ← WordPress標準のjQueryを解除! wp_enqueue_script( ← 元のjQueryを登録していく 'jquery', '//・・・・・・', ← 元のjQuieryのURL array(), '3.5.1' ← バージョン ); } add_action('wp_enqueue_scripts', 'sample_enqueue_scripts');
なんとか無事解決しました!
コメント