質問編集履歴

1

説明文を編集しました。

2016/12/08 14:00

投稿

lewishome
lewishome

スコア16

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- 長いタイトルですが、親テーマのstyle.cssが子テーマを適用した際にも呼び出されるようにするコードをfunctions.phpに記入したのですが、親テーマのcssが呼び出せていません。
1
+ 長いタイトルですが、親テーマのstyle.cssが子テーマを適用した際にも呼び出されるようにするコードをfunctions.phpに記入したのですが、親テーマのcssが呼び出せていません。呼び出せていないとは、styleシートが聞いていないつまり色とか全くない状態でhy
2
2
 
3
3
  [参考サイト](http://nelog.jp/wordpress-child-theme)
4
4
 
@@ -41,3 +41,31 @@
41
41
  閉じタグがないと作動しないと思ったのですが・・・
42
42
 
43
43
  また、このサイトに書かれているように@importを利用して呼び出す方法は時代遅れですよね?
44
+
45
+
46
+
47
+ 別のコードで子テーマのfunction.phpに書きましたが、結果は一緒で親テーマのcssが反映されていません。
48
+
49
+ ```php
50
+
51
+ <?php
52
+
53
+ add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
54
+
55
+ function theme_enqueue_styles() {
56
+
57
+ wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
58
+
59
+ wp_enqueue_style( 'child-style',
60
+
61
+ get_stylesheet_directory_uri() . '/style.css',
62
+
63
+ array('parent-style')
64
+
65
+ );
66
+
67
+ }
68
+
69
+ ?>
70
+
71
+ ```