forked from martin7jd/wpshepherd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchild_one.php
executable file
·67 lines (46 loc) · 1.91 KB
/
child_one.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/*
Creates the child directory of the current theme
Also creates the style.css with the required vwebiage
*/
# Website title
$web = $_POST['web'];
# Website theme name
$theme = $_POST['theme'];
# Create the child directory
$path = '../wordpress_' . $web . '/wp-content/themes/' . $theme . '-child/';
mkdir($path, 0700);
# Create the style.css file with the required verbiage
$style = $path . 'style.css';
$myFile = $style;
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "/*\n";
fwrite($fh, $stringData);
$stringData = "\t\tTheme Name:\t\t\t$theme-Child\n";
fwrite($fh, $stringData);
$stringData = "\t\tTheme URI:\t\t\thttp://example.com/\n";
fwrite($fh, $stringData);
$stringData = "\t\tDescription:\t\tChild theme for the $theme theme\n";
fwrite($fh, $stringData);
$stringData = "\t\tAuthor:\t\t\t\t\tYour name here\n";
fwrite($fh, $stringData);
$stringData = "\t\tAuthor URI:\t\t\thttp://example.com/about/\n";
fwrite($fh, $stringData);
$stringData = "\t\tTemplate:\t\t\t\t$theme\n";
fwrite($fh, $stringData);
$stringData = "\t\tVersion:\t\t\t\t0.1.0\n";
fwrite($fh, $stringData);
$stringData = "*/\n\n";
fwrite($fh, $stringData);
$stringData = "\t/* This line makes the original $theme css available */\n";
fwrite($fh, $stringData);
$stringData = "\t\t@import url(\"../$theme/style.css\");";
fwrite($fh, $stringData);
fclose($fh);
echo '<div id="sitename">';
echo '<h3>Congratulations</h3>';
echo 'Child theme directory and style.css created<br/>';
echo '<h3>Activate the child theme</h3>';
echo 'Log in to your site\'s dashboard, and go to Administration Panels > Appearance > Themes. You will see your child theme listed there. Click Activate.';
echo '</div>';
?>