質問編集履歴

7

修正

2016/12/25 13:48

投稿

kotori_00
kotori_00

スコア46

test CHANGED
File without changes
test CHANGED
@@ -92,6 +92,8 @@
92
92
 
93
93
  というエラーが出ています。
94
94
 
95
+ 引数に何か記述すればよいのか、ググってみてもわかりません。
96
+
95
97
 
96
98
 
97
99
  ![イメージ説明](9eb7df350ad4424b9dd78058e00fb350.png)

6

追記

2016/12/25 13:48

投稿

kotori_00
kotori_00

スコア46

test CHANGED
File without changes
test CHANGED
@@ -81,3 +81,17 @@
81
81
 
82
82
 
83
83
  ![イメージ説明](acff8c1ad44511a5f9c6ce4d467fbf19.png)
84
+
85
+
86
+
87
+ ###jquery.test.js
88
+
89
+
90
+
91
+ Uncaught SyntaxError: missing ) after argument list
92
+
93
+ というエラーが出ています。
94
+
95
+
96
+
97
+ ![イメージ説明](9eb7df350ad4424b9dd78058e00fb350.png)

5

追加

2016/12/25 13:46

投稿

kotori_00
kotori_00

スコア46

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,17 @@
67
67
  ?>
68
68
 
69
69
  ```
70
+
71
+
72
+
73
+ ###デベロッパーツルーでの確認(chrome)
74
+
75
+ 自作jqueryファイル(jquery.test.js)をデベロッパーツルーで確認してもうまく読み込まれていないためか、ファイル自体確認できませんでした。
76
+
77
+
78
+
79
+ 試しにjquery.test.jsファイル内にコードを記述しアップしてみたのですが変わりませんでした。
80
+
81
+
82
+
83
+ ![イメージ説明](acff8c1ad44511a5f9c6ce4d467fbf19.png)

4

修正

2016/12/25 08:03

投稿

kotori_00
kotori_00

スコア46

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  //wpのjqueryを読み込まない
46
46
 
47
- php wp_deregister_script('jquery');
47
+ wp_deregister_script('jquery');
48
48
 
49
49
 
50
50
 

3

修正

2016/12/25 06:04

投稿

kotori_00
kotori_00

スコア46

test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,6 @@
1
1
  ###解決したいこと
2
2
 
3
3
  オリジナルテーマのwordpressを制作しているのですが、自作したJQueyファイルを読み込ませたいです。ネットで調べて試してみたのですがうまくいきません。。
4
-
5
- ちなみにscript.jsのファイルはサーバーへアップロードしてもテーマ編集のファイル欄には表示されないのでしょうか。
6
4
 
7
5
 
8
6
 
@@ -11,6 +9,8 @@
11
9
  <追加>
12
10
 
13
11
  質問内容や記載コードを大幅に変更しました。
12
+
13
+ 自作ファイル:jquery.test.js
14
14
 
15
15
 
16
16
 

2

修正

2016/12/24 13:47

投稿

kotori_00
kotori_00

スコア46

test CHANGED
File without changes
test CHANGED
@@ -15,6 +15,14 @@
15
15
 
16
16
 
17
17
  ###functions.php
18
+
19
+ このコードを試してもエラーとなってしまいます。
20
+
21
+ <エラー文>
22
+
23
+ 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
24
+
25
+ ```jquery
18
26
 
19
27
  <?php
20
28
 
@@ -57,3 +65,5 @@
57
65
 
58
66
 
59
67
  ?>
68
+
69
+ ```

1

内容の変更

2016/12/24 13:44

投稿

kotori_00
kotori_00

スコア46

test CHANGED
File without changes
test CHANGED
@@ -6,164 +6,54 @@
6
6
 
7
7
 
8
8
 
9
- ###header.php
10
9
 
11
- ```ここに言語を入力
12
10
 
13
- <!DOCTYPE html>
11
+ <追加>
14
12
 
15
- <html>
16
-
17
- <head>
18
-
19
- <meta charset="utf-8">
20
-
21
- <title></title>
13
+ 質問内容や記載コードを大幅に変更しました。
22
-
23
- <meta name="descripton" content="">
24
-
25
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
26
14
 
27
15
 
28
16
 
29
- <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" />
17
+ ###functions.php
30
18
 
19
+ <?php
20
+
31
- <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/responsive.css" type="text/css" />
21
+ if ( function_exists('register_sidebar') )
22
+
23
+ register_sidebar();
24
+
25
+ ?>
32
26
 
33
27
 
34
28
 
35
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
29
+ <?php
36
30
 
37
31
 
38
32
 
39
- <script type="text/javascript" src="https://minmoji.ucda.jp/sealjs/http%3A__jikkyo-webdesigner.top" charset="UTF-8"></script>
33
+ function my_scripts() {
40
34
 
41
35
 
42
36
 
37
+ //wpのjqueryを読み込まない
38
+
43
- <link href="https://fonts.googleapis.com/css?family=Caveat" rel="stylesheet">
39
+ php wp_deregister_script('jquery');
44
40
 
45
41
 
46
42
 
43
+ //jqueryの読み込み
44
+
45
+ wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', "", "20160608", false );
47
46
 
48
47
 
49
48
 
49
+ //自作jaueryファイル
50
50
 
51
+ wp_enqueue_script( 'jquery', get_bloginfo( 'stylesheet_directory') . '/jquery.test.js', array(), false, true );
52
+
53
+ }
54
+
51
- <!-----------------jquery----------------------------->
55
+ add_action( 'wp_enqueue_scripts', 'my_scripts');
52
56
 
53
57
 
54
58
 
55
- <?php wp_deregister_script('jquery'); ?>
56
-
57
- <!-- WordPressのjQueryを読み込ませない -->
58
-
59
- <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/script.js"></script>
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
- <!-----------------jquery----------------------------->
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
- <?php wp_head( ); ?>
78
-
79
- </head>
80
-
81
- </head>
82
-
83
- <body>
59
+ ?>
84
-
85
- <header>
86
-
87
- <div class="header-wrapper">
88
-
89
- <a href="<?php echo home_url(); ?>">
90
-
91
- <h1 class="title-top"></h1>
92
-
93
- <h1 class="title-bottom"></h1><h1 class="title-bottom-tablet"></br></h1></a>
94
-
95
-
96
-
97
- <!--//以下キャッチフレーズ取得-->
98
-
99
- <div class="catch-p">
100
-
101
- <span class="blinking"><!--点滅-->
102
-
103
- <i class="fa fa-microphone" aria-hidden="true">&nbsp;</i></span><!--/.blinking-->
104
-
105
- <div class="catch-p-css">
106
-
107
- <?php bloginfo('description'); ?>
108
-
109
- </div><!--/.catch-p-css-->
110
-
111
- </div><!--/.catch-p-->
112
-
113
-
114
-
115
- </div><!--/.header-wrapper-->
116
-
117
-
118
-
119
- <div class="container">
120
-
121
- <div class="contents">
122
-
123
- <div id="sidebar-dami"><a href=#>menu</a></div><!--tablet用ダミー表示-->
124
-
125
- </div>
126
-
127
- </div>
128
-
129
-
130
-
131
- </header>
132
-
133
- ```
134
-
135
-
136
-
137
-
138
-
139
- ###script.js
140
-
141
- ```ここに言語を入力
142
-
143
-
144
-
145
- //反映されなかった。
146
-
147
-
148
-
149
- jQuery(function($) {
150
-
151
- $('#sidebar').hover(function(){
152
-
153
-
154
-
155
- $('#sidebar').hide();
156
-
157
- });
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
- });
166
-
167
-
168
-
169
- ```