回答編集履歴
2
参考URL追記
answer
CHANGED
@@ -18,4 +18,6 @@
|
|
18
18
|
wp_enqueue_script( 'jquery_teratail', get_bloginfo( 'stylesheet_directory') . '/jquery.test.js', array(), false, true );
|
19
19
|
}
|
20
20
|
add_action( 'wp_enqueue_scripts', 'my_scripts');
|
21
|
-
```
|
21
|
+
```
|
22
|
+
WordPress Codexを読みましょう。
|
23
|
+
[https://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/wp_enqueue_script](https://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/wp_enqueue_script)
|
1
動作確認済みコード追記
answer
CHANGED
@@ -1,4 +1,21 @@
|
|
1
1
|
> Parse error: syntax error, unexpected 'wp_deregister_script' (T_STRING) in /home/dream77/dream77.wp.xdomain.jp/public_html/wp-content/themes/ wp-simpleKotori/functions.php on line 11
|
2
2
|
|
3
3
|
エラー文が言っているとおり、コードの11行目を見ましょう。
|
4
|
-
`php`という文字が余計ではありませんか。
|
4
|
+
`php`という文字が余計ではありませんか。
|
5
|
+
|
6
|
+
###追記
|
7
|
+
ハンドル名が同じ`jquery`であるのが原因っぽい。
|
8
|
+
```PHP
|
9
|
+
function my_scripts() {
|
10
|
+
|
11
|
+
//wpのjqueryを読み込まない
|
12
|
+
wp_deregister_script('jquery');
|
13
|
+
|
14
|
+
//jqueryの読み込み
|
15
|
+
wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', "", "20160608", false );
|
16
|
+
|
17
|
+
//自作jqueryファイル
|
18
|
+
wp_enqueue_script( 'jquery_teratail', get_bloginfo( 'stylesheet_directory') . '/jquery.test.js', array(), false, true );
|
19
|
+
}
|
20
|
+
add_action( 'wp_enqueue_scripts', 'my_scripts');
|
21
|
+
```
|