質問編集履歴

2

console → console.log に修正

2022/01/24 07:56

投稿

jan123
jan123

スコア4

test CHANGED
File without changes
test CHANGED
@@ -21,5 +21,5 @@
21
21
  ■xxx.jsファイルの記述
22
22
 
23
23
  ```ここに言語を入力
24
- console(hoge.yyy)
24
+ console.log(hoge.yyy)
25
25
  ```

1

$hoge → $myValueの誤りでした。そこを修正しています。

2022/01/17 01:13

投稿

jan123
jan123

スコア4

test CHANGED
File without changes
test CHANGED
@@ -13,7 +13,7 @@
13
13
  function my_enqueue_scripts() {
14
14
  wp_enqueue_script('mytheme-script', get_template_directory_uri() . '/js/xxx.js', array( 'jquery' ), false, true);
15
15
  $myValue = array('yyy' => 'test');
16
- wp_localize_script( 'mytheme-script', 'hoge', $hoge );
16
+ wp_localize_script( 'mytheme-script', 'hoge', $myValue );
17
17
  }
18
18
  add_action( 'wp_enqueue_scripts', 'mytheme_scripts' );
19
19
  ```