回答編集履歴
1
追記
test
CHANGED
@@ -15,3 +15,35 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
とりあえず通常はFTPで使用中のテーマは確認できませんので。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
**追記**
|
22
|
+
|
23
|
+
これ以上は時間の無駄なので参考のコードを書いておく。
|
24
|
+
|
25
|
+
拡張子が必要かどうかは別として以下のようなコードで`/wp-content/themes`に有効中のテーマ名のファイルを生成する。
|
26
|
+
|
27
|
+
ファイル名をテーマ名にするようにしたのは可視性のみ。
|
28
|
+
|
29
|
+
これは全てのテーマの`functions.php`に書いておく必要がある。
|
30
|
+
|
31
|
+
```
|
32
|
+
|
33
|
+
function get_current_theme( $new_name, $new_theme, $old_theme ) {
|
34
|
+
|
35
|
+
file_put_contents( get_theme_root().'/'.$new_name.'.txt', $new_name );
|
36
|
+
|
37
|
+
$old_file = get_theme_root().'/'.$old_theme->get( 'Name' ).'.txt';
|
38
|
+
|
39
|
+
if ( file_exists( $old_file ) ) {
|
40
|
+
|
41
|
+
unlink( $old_file );
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
add_action( 'switch_theme', 'get_current_theme', 10, 3 );
|
48
|
+
|
49
|
+
```
|