回答編集履歴
1
コードサンプル追記
answer
CHANGED
@@ -7,4 +7,21 @@
|
|
7
7
|
テーマを有効化したタイミングで
|
8
8
|
theme_mods_{親テーマ名}を複製して
|
9
9
|
theme_mods_{子テーマ名}に入れる
|
10
|
-
というような処理をすればいいかと思います
|
10
|
+
というような処理をすればいいかと思います
|
11
|
+
|
12
|
+
---
|
13
|
+
|
14
|
+
コードサンプル追記
|
15
|
+
|
16
|
+
以下のコードをfunctions.phpに、テストしてません
|
17
|
+
|
18
|
+
```php
|
19
|
+
<?php
|
20
|
+
add_action('after_switch_theme',function(){
|
21
|
+
$theme_name = wp_get_theme()->get('Name');
|
22
|
+
if($parent_theme_name = wp_get_theme()->get('Template')){
|
23
|
+
add_option("theme_mods_$theme_name",get_option("theme_mods_$parent_theme_name"));
|
24
|
+
}
|
25
|
+
});
|
26
|
+
?>
|
27
|
+
```
|