wpgen 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/wpgen +11 -0
- data/lib/wpgen.rb +11 -0
- data/lib/wpgen/command_line_interface.rb +50 -0
- data/lib/wpgen/css_gen.rb +29 -0
- data/lib/wpgen/file_writer.rb +148 -0
- data/lib/wpgen/generator.rb +29 -0
- data/lib/wpgen/version.rb +5 -0
- data/templates/404.php +5 -0
- data/templates/archive.php +58 -0
- data/templates/comments.php +101 -0
- data/templates/css/ie.css +0 -0
- data/templates/css/reset.css +102 -0
- data/templates/footer.php +15 -0
- data/templates/functions.php +33 -0
- data/templates/header.php +56 -0
- data/templates/inc/meta.php +5 -0
- data/templates/inc/nav.php +4 -0
- data/templates/inc/paging.php +23 -0
- data/templates/index.php +35 -0
- data/templates/js/functions.js +3 -0
- data/templates/page-template.php +18 -0
- data/templates/page.php +29 -0
- data/templates/post-type.php +12 -0
- data/templates/register-sidebar.php +9 -0
- data/templates/screenshot.png +0 -0
- data/templates/search.php +37 -0
- data/templates/searchform.php +8 -0
- data/templates/sidebar.php +39 -0
- data/templates/single.php +31 -0
- data/templates/style.css +9 -0
- metadata +76 -0
data/bin/wpgen
ADDED
data/lib/wpgen.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
module Wpgen
|
2
|
+
class CommandLineInterface
|
3
|
+
def initialize
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
def new
|
8
|
+
FileWriter.new_theme ARGV[1]
|
9
|
+
end
|
10
|
+
|
11
|
+
def post
|
12
|
+
FileWriter.write_custom_post_type ARGV[1]
|
13
|
+
end
|
14
|
+
|
15
|
+
def page
|
16
|
+
FileWriter.write_page_template ARGV[1]
|
17
|
+
end
|
18
|
+
|
19
|
+
def sidebar
|
20
|
+
FileWriter.write_dynamic_sidebar ARGV[1]
|
21
|
+
end
|
22
|
+
|
23
|
+
def css
|
24
|
+
FileWriter.write_css ARGV[1]
|
25
|
+
end
|
26
|
+
|
27
|
+
def stylesheet
|
28
|
+
FileWriter.write_stylesheet
|
29
|
+
end
|
30
|
+
|
31
|
+
def method_missing(m, *args, &block)
|
32
|
+
help
|
33
|
+
end
|
34
|
+
|
35
|
+
def help
|
36
|
+
puts "WPGEN"
|
37
|
+
puts "Version: #{Wpgen::VERSION}"
|
38
|
+
puts "Author: Travis Luong"
|
39
|
+
puts ""
|
40
|
+
puts "Available commands:"
|
41
|
+
puts "wpgen new my_theme"
|
42
|
+
puts "wpgen post my_post"
|
43
|
+
puts "wpgen page my_page"
|
44
|
+
puts "wpgen sidebar my_sidebar"
|
45
|
+
puts "wpgen css file_name"
|
46
|
+
puts "wpgen stylesheet"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Wpgen
|
2
|
+
class CssGen
|
3
|
+
def self.get_ids string
|
4
|
+
array = string.scan(/id="([^"<]*)"/)
|
5
|
+
array.map { |id| id[0] }
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.get_classes string
|
9
|
+
array = string.scan(/class="([^"<]*)"/)
|
10
|
+
array.map { |c| c[0] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.generate_id_css array
|
14
|
+
css = ""
|
15
|
+
array.each do |id|
|
16
|
+
css << "##{id} {\n\n}\n\n"
|
17
|
+
end
|
18
|
+
css
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.generate_class_css array
|
22
|
+
css = ""
|
23
|
+
array.each do |css_class|
|
24
|
+
css << ".#{css_class} {\n\n}\n\n"
|
25
|
+
end
|
26
|
+
css
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
module Wpgen
|
2
|
+
|
3
|
+
class FileWriter
|
4
|
+
|
5
|
+
@@initial_folder_list = ["css", "inc", "js"]
|
6
|
+
@@initial_file_list = [
|
7
|
+
"css/reset.css",
|
8
|
+
"css/ie.css",
|
9
|
+
"inc/meta.php",
|
10
|
+
"inc/nav.php",
|
11
|
+
"inc/paging.php",
|
12
|
+
"js/functions.js",
|
13
|
+
"404.php",
|
14
|
+
"archive.php",
|
15
|
+
"comments.php",
|
16
|
+
"footer.php",
|
17
|
+
"functions.php",
|
18
|
+
"header.php",
|
19
|
+
"index.php",
|
20
|
+
"page.php",
|
21
|
+
"screenshot.png",
|
22
|
+
"search.php",
|
23
|
+
"searchform.php",
|
24
|
+
"sidebar.php",
|
25
|
+
"style.css"
|
26
|
+
]
|
27
|
+
@@write_css_ignore = ["functions.php"]
|
28
|
+
@@templates_dir = File.expand_path("../../templates", File.dirname(__FILE__))
|
29
|
+
|
30
|
+
def self.new_theme folder_name
|
31
|
+
mkdir "#{folder_name}"
|
32
|
+
|
33
|
+
@@initial_folder_list.each do |folder|
|
34
|
+
mkdir "#{folder_name}/#{folder}"
|
35
|
+
end
|
36
|
+
|
37
|
+
@@initial_file_list.each do |file|
|
38
|
+
mkfile file, @@templates_dir, folder_name
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.write_custom_post_type type
|
43
|
+
php_code = Generator.custom_post_type type
|
44
|
+
|
45
|
+
File.open("post-type-#{type}.php", "w") do |f|
|
46
|
+
f.puts php_code
|
47
|
+
end
|
48
|
+
|
49
|
+
File.open("functions.php", "r+") do |f|
|
50
|
+
php_code = f.read
|
51
|
+
php_code.gsub!(/\/\/ WPGEN custom post types/, "// WPGEN custom post types\nrequire_once 'post-type-#{type}.php'")
|
52
|
+
f.close
|
53
|
+
FileUtils.remove_file "functions.php"
|
54
|
+
File.open("functions.php", "w") do |f|
|
55
|
+
f.puts php_code
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
puts "Create file post-type-#{type}.php"
|
60
|
+
puts "Change functions.php"
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.write_page_template template_name
|
64
|
+
php_code = Generator.page_template template_name
|
65
|
+
|
66
|
+
File.open("page-template-#{template_name}.php", "w") do |f|
|
67
|
+
f.puts php_code
|
68
|
+
end
|
69
|
+
|
70
|
+
puts "Create file page-template-#{template_name}.php"
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.write_dynamic_sidebar sidebar_name
|
74
|
+
sidebar_code = Generator.dynamic_sidebar sidebar_name
|
75
|
+
|
76
|
+
File.open("functions.php", "r+") do |f|
|
77
|
+
functions_code = f.read
|
78
|
+
functions_code.gsub!(/\/\/ WPGEN register sidebars/, "// WPGEN register sidebars\n#{sidebar_code}")
|
79
|
+
f.close
|
80
|
+
FileUtils.remove_file "functions.php"
|
81
|
+
File.open("functions.php", "w") do |f|
|
82
|
+
f.puts functions_code
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
puts "Change file functions.php"
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.write_stylesheet
|
90
|
+
File.open("style.css", "a") do |stylesheet|
|
91
|
+
ids, c = get_all_css_selectors
|
92
|
+
stylesheet.puts CssGen.generate_id_css(ids)
|
93
|
+
stylesheet.puts CssGen.generate_class_css(c)
|
94
|
+
puts "Write selectors to style.css"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.write_css file
|
99
|
+
stylesheet = File.open("style.css", "a")
|
100
|
+
ids = get_ids_from_file file
|
101
|
+
c = get_classes_from_file file
|
102
|
+
stylesheet.puts CssGen.generate_id_css(ids)
|
103
|
+
stylesheet.puts CssGen.generate_class_css(c)
|
104
|
+
puts "Write selectors from #{file} to style.css"
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def self.mkdir path
|
110
|
+
Dir.mkdir path
|
111
|
+
puts "Create folder #{path}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.mkfile file_path, templates_dir, folder_name
|
115
|
+
FileUtils.cp "#{templates_dir}/#{file_path}", "#{folder_name}/#{file_path}"
|
116
|
+
puts "Create file #{folder_name}/#{file_path}"
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.get_all_css_selectors
|
120
|
+
php_files = Dir.glob("*.php")
|
121
|
+
php_files = php_files - @@write_css_ignore
|
122
|
+
ids = []
|
123
|
+
c = []
|
124
|
+
puts "Extracting ids and selectors from:"
|
125
|
+
php_files.each do |php_file|
|
126
|
+
ids.concat(get_ids_from_file(php_file))
|
127
|
+
c.concat(get_classes_from_file(php_file))
|
128
|
+
puts "\t#{php_file}"
|
129
|
+
end
|
130
|
+
return ids.uniq, c.uniq
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.get_ids_from_file file
|
134
|
+
File.open(file, "r") do |f|
|
135
|
+
CssGen.get_ids(f.read)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def self.get_classes_from_file file
|
140
|
+
File.open(file, "r") do |f|
|
141
|
+
CssGen.get_classes(f.read)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Wpgen
|
2
|
+
|
3
|
+
class Generator
|
4
|
+
@@templates_dir = File.expand_path("../../templates", File.dirname(__FILE__))
|
5
|
+
|
6
|
+
def self.custom_post_type type
|
7
|
+
File.open("#{@@templates_dir}/post-type.php", "r") do |f|
|
8
|
+
php_code = f.read
|
9
|
+
php_code.gsub!(/WPGEN_Token/, type.capitalize)
|
10
|
+
php_code.gsub!(/WPGEN_token/, type.downcase)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.page_template template_name
|
15
|
+
File.open("#{@@templates_dir}/page-template.php", "r") do |f|
|
16
|
+
php_code = f.read
|
17
|
+
php_code.gsub!(/WPGEN_Token/, template_name.capitalize)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.dynamic_sidebar sidebar_name
|
22
|
+
File.open("#{@@templates_dir}/register-sidebar.php") do |f|
|
23
|
+
php_code = f.read
|
24
|
+
php_code.gsub!(/WPGEN_Token/, sidebar_name.capitalize)
|
25
|
+
php_code.gsub!(/wpgen-token/, sidebar_name.downcase.gsub(/\s/, "-"))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/templates/404.php
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
<?php get_header(); ?>
|
2
|
+
|
3
|
+
<?php if (have_posts()) : ?>
|
4
|
+
|
5
|
+
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
|
6
|
+
|
7
|
+
<?php /* If this is a category archive */ if (is_category()) { ?>
|
8
|
+
<h2>Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
|
9
|
+
|
10
|
+
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
|
11
|
+
<h2>Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
|
12
|
+
|
13
|
+
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
|
14
|
+
<h2>Archive for <?php the_time('F jS, Y'); ?></h2>
|
15
|
+
|
16
|
+
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
|
17
|
+
<h2>Archive for <?php the_time('F, Y'); ?></h2>
|
18
|
+
|
19
|
+
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
|
20
|
+
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
|
21
|
+
|
22
|
+
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
|
23
|
+
<h2 class="pagetitle">Author Archive</h2>
|
24
|
+
|
25
|
+
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
|
26
|
+
<h2 class="pagetitle">Blog Archives</h2>
|
27
|
+
|
28
|
+
<?php } ?>
|
29
|
+
|
30
|
+
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
|
31
|
+
|
32
|
+
<?php while (have_posts()) : the_post(); ?>
|
33
|
+
|
34
|
+
<div <?php post_class() ?>>
|
35
|
+
|
36
|
+
<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
|
37
|
+
|
38
|
+
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
|
39
|
+
|
40
|
+
<div class="entry">
|
41
|
+
<?php the_content(); ?>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<?php endwhile; ?>
|
47
|
+
|
48
|
+
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
|
49
|
+
|
50
|
+
<?php else : ?>
|
51
|
+
|
52
|
+
<h2>Nothing found</h2>
|
53
|
+
|
54
|
+
<?php endif; ?>
|
55
|
+
|
56
|
+
<?php //get_sidebar(); ?>
|
57
|
+
|
58
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,101 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
4
|
+
die ('Please do not load this page directly. Thanks!');
|
5
|
+
|
6
|
+
if ( post_password_required() ) { ?>
|
7
|
+
This post is password protected. Enter the password to view comments.
|
8
|
+
<?php
|
9
|
+
return;
|
10
|
+
}
|
11
|
+
?>
|
12
|
+
|
13
|
+
<?php if ( have_comments() ) : ?>
|
14
|
+
|
15
|
+
<h2 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?></h2>
|
16
|
+
|
17
|
+
<div class="navigation">
|
18
|
+
<div class="next-posts"><?php previous_comments_link() ?></div>
|
19
|
+
<div class="prev-posts"><?php next_comments_link() ?></div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<ol class="commentlist">
|
23
|
+
<?php wp_list_comments(); ?>
|
24
|
+
</ol>
|
25
|
+
|
26
|
+
<div class="navigation">
|
27
|
+
<div class="next-posts"><?php previous_comments_link() ?></div>
|
28
|
+
<div class="prev-posts"><?php next_comments_link() ?></div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<?php else : // this is displayed if there are no comments so far ?>
|
32
|
+
|
33
|
+
<?php if ( comments_open() ) : ?>
|
34
|
+
<!-- If comments are open, but there are no comments. -->
|
35
|
+
|
36
|
+
<?php else : // comments are closed ?>
|
37
|
+
<p>Comments are closed.</p>
|
38
|
+
|
39
|
+
<?php endif; ?>
|
40
|
+
|
41
|
+
<?php endif; ?>
|
42
|
+
|
43
|
+
<?php if ( comments_open() ) : ?>
|
44
|
+
|
45
|
+
<div id="respond">
|
46
|
+
|
47
|
+
<h2><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h2>
|
48
|
+
|
49
|
+
<div class="cancel-comment-reply">
|
50
|
+
<?php cancel_comment_reply_link(); ?>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
|
54
|
+
<p>You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.</p>
|
55
|
+
<?php else : ?>
|
56
|
+
|
57
|
+
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
|
58
|
+
|
59
|
+
<?php if ( is_user_logged_in() ) : ?>
|
60
|
+
|
61
|
+
<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out »</a></p>
|
62
|
+
|
63
|
+
<?php else : ?>
|
64
|
+
|
65
|
+
<div>
|
66
|
+
<input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
|
67
|
+
<label for="author">Name <?php if ($req) echo "(required)"; ?></label>
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div>
|
71
|
+
<input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
|
72
|
+
<label for="email">Mail (will not be published) <?php if ($req) echo "(required)"; ?></label>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div>
|
76
|
+
<input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
|
77
|
+
<label for="url">Website</label>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<?php endif; ?>
|
81
|
+
|
82
|
+
<!--<p>You can use these tags: <code><?php echo allowed_tags(); ?></code></p>-->
|
83
|
+
|
84
|
+
<div>
|
85
|
+
<textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div>
|
89
|
+
<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
|
90
|
+
<?php comment_id_fields(); ?>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<?php do_action('comment_form', $post->ID); ?>
|
94
|
+
|
95
|
+
</form>
|
96
|
+
|
97
|
+
<?php endif; // If registration required and not logged in ?>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<?php endif; ?>
|
File without changes
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/*
|
2
|
+
html5doctor.com Reset Stylesheet
|
3
|
+
v1.6.1
|
4
|
+
Last Updated: 2010-09-17
|
5
|
+
Author: Richard Clark - http://richclarkdesign.com
|
6
|
+
Twitter: @rich_clark
|
7
|
+
*/
|
8
|
+
|
9
|
+
html, body, div, span, object, iframe,
|
10
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
11
|
+
abbr, address, cite, code,
|
12
|
+
del, dfn, em, img, ins, kbd, q, samp,
|
13
|
+
small, strong, sub, sup, var,
|
14
|
+
b, i,
|
15
|
+
dl, dt, dd, ol, ul, li,
|
16
|
+
fieldset, form, label, legend,
|
17
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
18
|
+
article, aside, canvas, details, figcaption, figure,
|
19
|
+
footer, header, hgroup, menu, nav, section, summary,
|
20
|
+
time, mark, audio, video {
|
21
|
+
margin:0;
|
22
|
+
padding:0;
|
23
|
+
border:0;
|
24
|
+
outline:0;
|
25
|
+
font-size:100%;
|
26
|
+
vertical-align:baseline;
|
27
|
+
background:transparent;
|
28
|
+
}
|
29
|
+
|
30
|
+
body {
|
31
|
+
line-height:1;
|
32
|
+
}
|
33
|
+
|
34
|
+
article,aside,details,figcaption,figure,
|
35
|
+
footer,header,hgroup,menu,nav,section {
|
36
|
+
display:block;
|
37
|
+
}
|
38
|
+
|
39
|
+
nav ul {
|
40
|
+
list-style:none;
|
41
|
+
}
|
42
|
+
|
43
|
+
blockquote, q {
|
44
|
+
quotes:none;
|
45
|
+
}
|
46
|
+
|
47
|
+
blockquote:before, blockquote:after,
|
48
|
+
q:before, q:after {
|
49
|
+
content:'';
|
50
|
+
content:none;
|
51
|
+
}
|
52
|
+
|
53
|
+
a {
|
54
|
+
margin:0;
|
55
|
+
padding:0;
|
56
|
+
font-size:100%;
|
57
|
+
vertical-align:baseline;
|
58
|
+
background:transparent;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* change colours to suit your needs */
|
62
|
+
ins {
|
63
|
+
background-color:#ff9;
|
64
|
+
color:#000;
|
65
|
+
text-decoration:none;
|
66
|
+
}
|
67
|
+
|
68
|
+
/* change colours to suit your needs */
|
69
|
+
mark {
|
70
|
+
background-color:#ff9;
|
71
|
+
color:#000;
|
72
|
+
font-style:italic;
|
73
|
+
font-weight:bold;
|
74
|
+
}
|
75
|
+
|
76
|
+
del {
|
77
|
+
text-decoration: line-through;
|
78
|
+
}
|
79
|
+
|
80
|
+
abbr[title], dfn[title] {
|
81
|
+
border-bottom:1px dotted;
|
82
|
+
cursor:help;
|
83
|
+
}
|
84
|
+
|
85
|
+
table {
|
86
|
+
border-collapse:collapse;
|
87
|
+
border-spacing:0;
|
88
|
+
}
|
89
|
+
|
90
|
+
/* change border colour to suit your needs */
|
91
|
+
hr {
|
92
|
+
display:block;
|
93
|
+
height:1px;
|
94
|
+
border:0;
|
95
|
+
border-top:1px solid #cccccc;
|
96
|
+
margin:1em 0;
|
97
|
+
padding:0;
|
98
|
+
}
|
99
|
+
|
100
|
+
input, select {
|
101
|
+
vertical-align:middle;
|
102
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div id="footer">
|
2
|
+
©<?php echo date("Y"); echo " "; bloginfo('name'); ?>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<?php wp_footer(); ?>
|
8
|
+
|
9
|
+
<!-- Don't forget analytics -->
|
10
|
+
|
11
|
+
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/functions.js"></script>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
|
15
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
// Add RSS links to <head> section
|
4
|
+
automatic_feed_links();
|
5
|
+
|
6
|
+
// Load jQuery
|
7
|
+
if ( !is_admin() ) {
|
8
|
+
wp_deregister_script('jquery');
|
9
|
+
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"), false);
|
10
|
+
wp_enqueue_script('jquery');
|
11
|
+
}
|
12
|
+
|
13
|
+
// Clean up the <head>
|
14
|
+
function removeHeadLinks() {
|
15
|
+
remove_action('wp_head', 'rsd_link');
|
16
|
+
remove_action('wp_head', 'wlwmanifest_link');
|
17
|
+
}
|
18
|
+
add_action('init', 'removeHeadLinks');
|
19
|
+
remove_action('wp_head', 'wp_generator');
|
20
|
+
|
21
|
+
// WPGEN register sidebars
|
22
|
+
register_sidebar(array(
|
23
|
+
'name' => 'Sidebar Widgets',
|
24
|
+
'id' => 'sidebar-widgets',
|
25
|
+
'description' => 'These are widgets for the sidebar.',
|
26
|
+
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
27
|
+
'after_widget' => '</div>',
|
28
|
+
'before_title' => '<h2>',
|
29
|
+
'after_title' => '</h2>'
|
30
|
+
));
|
31
|
+
|
32
|
+
|
33
|
+
// WPGEN custom post types
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html <?php language_attributes(); ?>>
|
4
|
+
|
5
|
+
<head>
|
6
|
+
|
7
|
+
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
|
8
|
+
|
9
|
+
<?php if (is_search()) { ?>
|
10
|
+
<meta name="robots" content="noindex, nofollow" />
|
11
|
+
<?php } ?>
|
12
|
+
|
13
|
+
<title>
|
14
|
+
<?php
|
15
|
+
if (function_exists('is_tag') && is_tag()) {
|
16
|
+
single_tag_title("Tag Archive for ""); echo '" - '; }
|
17
|
+
elseif (is_archive()) {
|
18
|
+
wp_title(''); echo ' Archive - '; }
|
19
|
+
elseif (is_search()) {
|
20
|
+
echo 'Search for "'.wp_specialchars($s).'" - '; }
|
21
|
+
elseif (!(is_404()) && (is_single()) || (is_page())) {
|
22
|
+
wp_title(''); echo ' - '; }
|
23
|
+
elseif (is_404()) {
|
24
|
+
echo 'Not Found - '; }
|
25
|
+
if (is_home()) {
|
26
|
+
bloginfo('name'); echo ' - '; bloginfo('description'); }
|
27
|
+
else {
|
28
|
+
bloginfo('name'); }
|
29
|
+
if ($paged>1) {
|
30
|
+
echo ' - page '. $paged; }
|
31
|
+
?>
|
32
|
+
</title>
|
33
|
+
|
34
|
+
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
35
|
+
|
36
|
+
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/reset.css" type="text/css">
|
37
|
+
|
38
|
+
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
|
39
|
+
|
40
|
+
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
|
41
|
+
|
42
|
+
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
|
43
|
+
|
44
|
+
<?php wp_head(); ?>
|
45
|
+
|
46
|
+
</head>
|
47
|
+
|
48
|
+
<body <?php body_class(); ?>>
|
49
|
+
|
50
|
+
<div id="page-wrap">
|
51
|
+
|
52
|
+
<div id="header">
|
53
|
+
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
|
54
|
+
<div class="description"><?php bloginfo('description'); ?></div>
|
55
|
+
</div>
|
56
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div></div>
|
2
|
+
|
3
|
+
<div class="paging">
|
4
|
+
<?php
|
5
|
+
|
6
|
+
global $wp_query;
|
7
|
+
|
8
|
+
$total_pages = $wp_query->max_num_pages;
|
9
|
+
|
10
|
+
if ($total_pages > 1){
|
11
|
+
|
12
|
+
$current_page = max(1, get_query_var('paged'));
|
13
|
+
|
14
|
+
echo paginate_links(array(
|
15
|
+
'base' => get_pagenum_link(1) . '%_%',
|
16
|
+
'format' => '/page/%#%',
|
17
|
+
'current' => $current_page,
|
18
|
+
'total' => $total_pages,
|
19
|
+
));
|
20
|
+
}
|
21
|
+
|
22
|
+
?>
|
23
|
+
</div>
|
data/templates/index.php
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
<?php get_header(); ?>
|
2
|
+
|
3
|
+
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
4
|
+
|
5
|
+
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
|
6
|
+
|
7
|
+
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
|
8
|
+
|
9
|
+
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
|
10
|
+
|
11
|
+
<div class="entry">
|
12
|
+
<?php the_content(); ?>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="postmetadata">
|
16
|
+
<?php the_tags('Tags: ', ', ', '<br />'); ?>
|
17
|
+
Posted in <?php the_category(', ') ?> |
|
18
|
+
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<?php endwhile; ?>
|
24
|
+
|
25
|
+
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
|
26
|
+
|
27
|
+
<?php else : ?>
|
28
|
+
|
29
|
+
<h2>Not Found</h2>
|
30
|
+
|
31
|
+
<?php endif; ?>
|
32
|
+
|
33
|
+
<?php //get_sidebar(); ?>
|
34
|
+
|
35
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?php
|
2
|
+
/*
|
3
|
+
Template Name: WPGEN_Token
|
4
|
+
*/
|
5
|
+
?>
|
6
|
+
<?php get_header(); ?>
|
7
|
+
|
8
|
+
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
9
|
+
|
10
|
+
<?php the_title(); ?>
|
11
|
+
|
12
|
+
<?php the_post_thumbnail(); ?>
|
13
|
+
|
14
|
+
<?php the_content(); ?>
|
15
|
+
|
16
|
+
<?php endwhile; endif; ?>
|
17
|
+
|
18
|
+
<?php get_footer(); ?>
|
data/templates/page.php
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
<?php get_header(); ?>
|
2
|
+
|
3
|
+
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
4
|
+
|
5
|
+
<div class="post" id="post-<?php the_ID(); ?>">
|
6
|
+
|
7
|
+
<h2><?php the_title(); ?></h2>
|
8
|
+
|
9
|
+
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
|
10
|
+
|
11
|
+
<div class="entry">
|
12
|
+
|
13
|
+
<?php the_content(); ?>
|
14
|
+
|
15
|
+
<?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
|
16
|
+
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
|
20
|
+
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<?php comments_template(); ?>
|
24
|
+
|
25
|
+
<?php endwhile; endif; ?>
|
26
|
+
|
27
|
+
<?php //get_sidebar(); ?>
|
28
|
+
|
29
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
// WPGEN_Token custom content type
|
4
|
+
function post_type_WPGEN_token() {
|
5
|
+
register_post_type('WPGEN_token',
|
6
|
+
array('label' => __('WPGEN_Token'),
|
7
|
+
'public' => true,
|
8
|
+
'show_ui' => true,
|
9
|
+
'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'thumbnail' ),
|
10
|
+
));
|
11
|
+
}
|
12
|
+
add_action('init', 'post_type_WPGEN_token');
|
Binary file
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<?php get_header(); ?>
|
2
|
+
|
3
|
+
<?php if (have_posts()) : ?>
|
4
|
+
|
5
|
+
<h2>Search Results</h2>
|
6
|
+
|
7
|
+
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
|
8
|
+
|
9
|
+
<?php while (have_posts()) : the_post(); ?>
|
10
|
+
|
11
|
+
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
|
12
|
+
|
13
|
+
<h2><?php the_title(); ?></h2>
|
14
|
+
|
15
|
+
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
|
16
|
+
|
17
|
+
<div class="entry">
|
18
|
+
|
19
|
+
<?php the_excerpt(); ?>
|
20
|
+
|
21
|
+
</div>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<?php endwhile; ?>
|
26
|
+
|
27
|
+
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
|
28
|
+
|
29
|
+
<?php else : ?>
|
30
|
+
|
31
|
+
<h2>No posts found.</h2>
|
32
|
+
|
33
|
+
<?php endif; ?>
|
34
|
+
|
35
|
+
<?php //get_sidebar(); ?>
|
36
|
+
|
37
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<form action="<?php bloginfo('siteurl'); ?>" id="searchform" method="get">
|
2
|
+
<div>
|
3
|
+
<label for="s" class="screen-reader-text">Search for:</label>
|
4
|
+
<input type="text" id="s" name="s" value="" />
|
5
|
+
|
6
|
+
<input type="submit" value="Search" id="searchsubmit" />
|
7
|
+
</div>
|
8
|
+
</form>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<div id="sidebar">
|
2
|
+
|
3
|
+
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Widgets')) : else : ?>
|
4
|
+
|
5
|
+
<!-- All this stuff in here only shows up if you DON'T have any widgets active in this zone -->
|
6
|
+
|
7
|
+
<?php get_search_form(); ?>
|
8
|
+
|
9
|
+
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
|
10
|
+
|
11
|
+
<h2>Archives</h2>
|
12
|
+
<ul>
|
13
|
+
<?php wp_get_archives('type=monthly'); ?>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<h2>Categories</h2>
|
17
|
+
<ul>
|
18
|
+
<?php wp_list_categories('show_count=1&title_li='); ?>
|
19
|
+
</ul>
|
20
|
+
|
21
|
+
<?php wp_list_bookmarks(); ?>
|
22
|
+
|
23
|
+
<h2>Meta</h2>
|
24
|
+
<ul>
|
25
|
+
<?php wp_register(); ?>
|
26
|
+
<li><?php wp_loginout(); ?></li>
|
27
|
+
<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
|
28
|
+
<?php wp_meta(); ?>
|
29
|
+
</ul>
|
30
|
+
|
31
|
+
<h2>Subscribe</h2>
|
32
|
+
<ul>
|
33
|
+
<li><a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a></li>
|
34
|
+
<li><a href="<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a></li>
|
35
|
+
</ul>
|
36
|
+
|
37
|
+
<?php endif; ?>
|
38
|
+
|
39
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?php get_header(); ?>
|
2
|
+
|
3
|
+
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
4
|
+
|
5
|
+
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
|
6
|
+
|
7
|
+
<h2><?php the_title(); ?></h2>
|
8
|
+
|
9
|
+
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
|
10
|
+
|
11
|
+
<div class="entry">
|
12
|
+
|
13
|
+
<?php the_content(); ?>
|
14
|
+
|
15
|
+
<?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
|
16
|
+
|
17
|
+
<?php the_tags( 'Tags: ', ', ', ''); ?>
|
18
|
+
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<?php edit_post_link('Edit this entry','','.'); ?>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<?php comments_template(); ?>
|
26
|
+
|
27
|
+
<?php endwhile; endif; ?>
|
28
|
+
|
29
|
+
<?php //get_sidebar(); ?>
|
30
|
+
|
31
|
+
<?php get_footer(); ?>
|
data/templates/style.css
ADDED
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wpgen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Travis Luong
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A command line program for generating blank themes
|
15
|
+
email: travis@travisluong.com
|
16
|
+
executables:
|
17
|
+
- wpgen
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/wpgen.rb
|
22
|
+
- lib/wpgen/command_line_interface.rb
|
23
|
+
- lib/wpgen/generator.rb
|
24
|
+
- lib/wpgen/file_writer.rb
|
25
|
+
- lib/wpgen/version.rb
|
26
|
+
- lib/wpgen/css_gen.rb
|
27
|
+
- templates/404.php
|
28
|
+
- templates/archive.php
|
29
|
+
- templates/comments.php
|
30
|
+
- templates/footer.php
|
31
|
+
- templates/functions.php
|
32
|
+
- templates/header.php
|
33
|
+
- templates/index.php
|
34
|
+
- templates/page-template.php
|
35
|
+
- templates/page.php
|
36
|
+
- templates/post-type.php
|
37
|
+
- templates/register-sidebar.php
|
38
|
+
- templates/screenshot.png
|
39
|
+
- templates/search.php
|
40
|
+
- templates/searchform.php
|
41
|
+
- templates/sidebar.php
|
42
|
+
- templates/single.php
|
43
|
+
- templates/style.css
|
44
|
+
- templates/css/ie.css
|
45
|
+
- templates/css/reset.css
|
46
|
+
- templates/inc/meta.php
|
47
|
+
- templates/inc/nav.php
|
48
|
+
- templates/inc/paging.php
|
49
|
+
- templates/js/functions.js
|
50
|
+
- bin/wpgen
|
51
|
+
homepage: http://rubygems.org/gems/wpgem
|
52
|
+
licenses: []
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.8.24
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: WordPress blank theme generator
|
75
|
+
test_files: []
|
76
|
+
has_rdoc:
|