wordpressでjsファイルを読み込ませたいのですが、うまくいきません。。。
コードを書いているcontact.phpについては
php
1<?php 2function calendar_scripts() { 3 //wordpress特有のjqueryを読み込まない 4 wp_deregister_script('jquery'); 5 6 //jsファイルの読み込み 7 wp_enqueue_script( 'jquery', get_stylesheet_directory_uri().'/js/jQuery.min.js' , array()); 8 wp_enqueue_script( 'entercalendar-script', get_stylesheet_directory_uri().'/js/enterCalendar.js' , array()); 9} 10 11add_action( 'wp_enqueue_scripts', 'calendar_scripts' ); 12?>
エラーとしては
syntax error, unexpected 'wp_enqueue_script' (T_STRING) in C:\xampp\htdocs\test\sample\wp-content\themes\twentyseventeen\contact.php on line 168
と出てきます。
line168はjsファイル読み込み2回目のところです。
調べてみても同じ方法を試してはみてもこのエラーが出てきます、、、助力お願いいたします。。。
stampdoorさんから教えていただいたことを行った後の追記
コメント欄に書かせていただいたエラーが起こったところの画像
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/04/19 03:34
2018/04/19 03:39
2018/04/19 03:43
2018/04/19 03:51
2018/04/19 04:00
2018/04/19 04:03
2018/04/19 04:05
2018/04/19 04:06
2018/04/19 04:10
2018/04/19 04:35