質問するログイン新規登録

質問編集履歴

7

修正

2016/12/25 13:48

投稿

kotori_00
kotori_00

スコア46

title CHANGED
File without changes
body CHANGED
@@ -45,5 +45,6 @@
45
45
 
46
46
  Uncaught SyntaxError: missing ) after argument list
47
47
  というエラーが出ています。
48
+ 引数に何か記述すればよいのか、ググってみてもわかりません。
48
49
 
49
50
  ![イメージ説明](9eb7df350ad4424b9dd78058e00fb350.png)

6

追記

2016/12/25 13:48

投稿

kotori_00
kotori_00

スコア46

title CHANGED
File without changes
body CHANGED
@@ -39,4 +39,11 @@
39
39
 
40
40
  試しにjquery.test.jsファイル内にコードを記述しアップしてみたのですが変わりませんでした。
41
41
 
42
- ![イメージ説明](acff8c1ad44511a5f9c6ce4d467fbf19.png)
42
+ ![イメージ説明](acff8c1ad44511a5f9c6ce4d467fbf19.png)
43
+
44
+ ###jquery.test.js
45
+
46
+ Uncaught SyntaxError: missing ) after argument list
47
+ というエラーが出ています。
48
+
49
+ ![イメージ説明](9eb7df350ad4424b9dd78058e00fb350.png)

5

追加

2016/12/25 13:46

投稿

kotori_00
kotori_00

スコア46

title CHANGED
File without changes
body CHANGED
@@ -32,4 +32,11 @@
32
32
  add_action( 'wp_enqueue_scripts', 'my_scripts');
33
33
 
34
34
  ?>
35
- ```
35
+ ```
36
+
37
+ ###デベロッパーツルーでの確認(chrome)
38
+ 自作jqueryファイル(jquery.test.js)をデベロッパーツルーで確認してもうまく読み込まれていないためか、ファイル自体確認できませんでした。
39
+
40
+ 試しにjquery.test.jsファイル内にコードを記述しアップしてみたのですが変わりませんでした。
41
+
42
+ ![イメージ説明](acff8c1ad44511a5f9c6ce4d467fbf19.png)

4

修正

2016/12/25 08:03

投稿

kotori_00
kotori_00

スコア46

title CHANGED
File without changes
body CHANGED
@@ -21,7 +21,7 @@
21
21
  function my_scripts() {
22
22
 
23
23
  //wpのjqueryを読み込まない
24
- php wp_deregister_script('jquery');
24
+ wp_deregister_script('jquery');
25
25
 
26
26
  //jqueryの読み込み
27
27
  wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', "", "20160608", false );

3

修正

2016/12/25 06:04

投稿

kotori_00
kotori_00

スコア46

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

2

修正

2016/12/24 13:47

投稿

kotori_00
kotori_00

スコア46

title CHANGED
File without changes
body CHANGED
@@ -7,6 +7,10 @@
7
7
  質問内容や記載コードを大幅に変更しました。
8
8
 
9
9
  ###functions.php
10
+ このコードを試してもエラーとなってしまいます。
11
+ <エラー文>
12
+ 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
13
+ ```jquery
10
14
  <?php
11
15
  if ( function_exists('register_sidebar') )
12
16
  register_sidebar();
@@ -27,4 +31,5 @@
27
31
  }
28
32
  add_action( 'wp_enqueue_scripts', 'my_scripts');
29
33
 
30
- ?>
34
+ ?>
35
+ ```

1

内容の変更

2016/12/24 13:44

投稿

kotori_00
kotori_00

スコア46

title CHANGED
File without changes
body CHANGED
@@ -2,84 +2,29 @@
2
2
  オリジナルテーマのwordpressを制作しているのですが、自作したJQueyファイルを読み込ませたいです。ネットで調べて試してみたのですがうまくいきません。。
3
3
  ちなみにscript.jsのファイルはサーバーへアップロードしてもテーマ編集のファイル欄には表示されないのでしょうか。
4
4
 
5
- ###header.php
6
- ```ここに言語を入力
7
- <!DOCTYPE html>
8
- <html>
9
- <head>
10
- <meta charset="utf-8">
11
- <title></title>
12
- <meta name="descripton" content="">
13
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
5
 
6
+ <追加>
15
- <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" />
7
+ 質問内容や記載コードを大幅に変更しました。
16
- <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/responsive.css" type="text/css" />
17
8
 
9
+ ###functions.php
10
+ <?php
18
- <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
11
+ if ( function_exists('register_sidebar') )
12
+ register_sidebar();
13
+ ?>
19
14
 
20
- <script type="text/javascript" src="https://minmoji.ucda.jp/sealjs/http%3A__jikkyo-webdesigner.top" charset="UTF-8"></script>
15
+ <?php
21
16
 
22
- <link href="https://fonts.googleapis.com/css?family=Caveat" rel="stylesheet">
17
+ function my_scripts() {
23
18
 
19
+ //wpのjqueryを読み込まない
20
+ php wp_deregister_script('jquery');
24
21
 
22
+ //jqueryの読み込み
23
+ wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', "", "20160608", false );
25
24
 
25
+ //自作jaueryファイル
26
+ wp_enqueue_script( 'jquery', get_bloginfo( 'stylesheet_directory') . '/jquery.test.js', array(), false, true );
27
+ }
26
- <!-----------------jquery----------------------------->
28
+ add_action( 'wp_enqueue_scripts', 'my_scripts');
27
29
 
28
- <?php wp_deregister_script('jquery'); ?>
29
- <!-- WordPressのjQueryを読み込ませない -->
30
- <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/script.js"></script>
31
-
32
-
33
-
34
- <!-----------------jquery----------------------------->
35
-
36
-
37
-
38
-
39
- <?php wp_head( ); ?>
40
- </head>
41
- </head>
42
- <body>
30
+ ?>
43
- <header>
44
- <div class="header-wrapper">
45
- <a href="<?php echo home_url(); ?>">
46
- <h1 class="title-top"></h1>
47
- <h1 class="title-bottom"></h1><h1 class="title-bottom-tablet"></br></h1></a>
48
-
49
- <!--//以下キャッチフレーズ取得-->
50
- <div class="catch-p">
51
- <span class="blinking"><!--点滅-->
52
- <i class="fa fa-microphone" aria-hidden="true">&nbsp;</i></span><!--/.blinking-->
53
- <div class="catch-p-css">
54
- <?php bloginfo('description'); ?>
55
- </div><!--/.catch-p-css-->
56
- </div><!--/.catch-p-->
57
-
58
- </div><!--/.header-wrapper-->
59
-
60
- <div class="container">
61
- <div class="contents">
62
- <div id="sidebar-dami"><a href=#>menu</a></div><!--tablet用ダミー表示-->
63
- </div>
64
- </div>
65
-
66
- </header>
67
- ```
68
-
69
-
70
- ###script.js
71
- ```ここに言語を入力
72
-
73
- //反映されなかった。
74
-
75
- jQuery(function($) {
76
- $('#sidebar').hover(function(){
77
-
78
- $('#sidebar').hide();
79
- });
80
-
81
-
82
-
83
- });
84
-
85
- ```