wp_scaffold 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/wp +18 -0
- data/lib/.DS_Store +0 -0
- data/lib/wp_scaffold/generator.rb +81 -0
- data/lib/wp_scaffold/helper.rb +11 -0
- data/lib/wp_scaffold/templates/.DS_Store +0 -0
- data/lib/wp_scaffold/templates/custom_post_type/page-custom.php +50 -0
- data/lib/wp_scaffold/templates/custom_post_type/register-cpt.php +31 -0
- data/lib/wp_scaffold/templates/custom_post_type/single-custom.php +18 -0
- data/lib/wp_scaffold/templates/theme_base/.gitignore +2 -0
- data/lib/wp_scaffold/templates/theme_base/README.md +4 -0
- data/lib/wp_scaffold/templates/theme_base/category.php +19 -0
- data/lib/wp_scaffold/templates/theme_base/coffee/main.coffee +2 -0
- data/lib/wp_scaffold/templates/theme_base/footer.php +15 -0
- data/lib/wp_scaffold/templates/theme_base/front-page.php +18 -0
- data/lib/wp_scaffold/templates/theme_base/functions/breadcrumbs.php +23 -0
- data/lib/wp_scaffold/templates/theme_base/functions/theme-settings.php +60 -0
- data/lib/wp_scaffold/templates/theme_base/functions.php +44 -0
- data/lib/wp_scaffold/templates/theme_base/header.php +31 -0
- data/lib/wp_scaffold/templates/theme_base/home.php +17 -0
- data/lib/wp_scaffold/templates/theme_base/index.php +18 -0
- data/lib/wp_scaffold/templates/theme_base/js/main.js +2 -0
- data/lib/wp_scaffold/templates/theme_base/js/vendor/fastclick.js +762 -0
- data/lib/wp_scaffold/templates/theme_base/js/vendor/html5shiv.js +8 -0
- data/lib/wp_scaffold/templates/theme_base/js/vendor/jquery.easydropdown.min.js +24 -0
- data/lib/wp_scaffold/templates/theme_base/js/vendor/retina-1.1.0.min.js +10 -0
- data/lib/wp_scaffold/templates/theme_base/page.php +22 -0
- data/lib/wp_scaffold/templates/theme_base/partials/content-post.php +33 -0
- data/lib/wp_scaffold/templates/theme_base/screenshot.png +0 -0
- data/lib/wp_scaffold/templates/theme_base/single.php +17 -0
- data/lib/wp_scaffold/templates/theme_base/style.css +211 -0
- data/lib/wp_scaffold/templates/theme_base/styles/_base.scss +36 -0
- data/lib/wp_scaffold/templates/theme_base/styles/_grid.scss +327 -0
- data/lib/wp_scaffold/templates/theme_base/styles/_normalize.scss +410 -0
- data/lib/wp_scaffold/templates/theme_base/styles/style.scss +19 -0
- data/lib/wp_scaffold/usage.txt +11 -0
- data/lib/wp_scaffold/version.rb +3 -0
- data/lib/wp_scaffold.rb +12 -0
- data/wp_scaffold.gemspec +23 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 05571b854df3f402e311456088adbfa0edb3e141
|
4
|
+
data.tar.gz: db548368dec030359bf4c579968a74ae4adeb0ed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aa8c6d2e846abb59090b484956deec6a2ec0b0b5150623d544df79dc1636cd06982bf28f71a37d5abc9fc038b5d9cba5d3530fad4d7d0859c378c82fd98bd407
|
7
|
+
data.tar.gz: 7d6165299b469fb36249e51150d0826f56db0289dd270f66575bbc4c8eebb2d995c260c081a02ca43dc96265362730b1c2753a0e54c7bd6fd04b7d2f4a0ba7f0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Nathan Hackley
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# WpScaffold
|
2
|
+
|
3
|
+
Scaffold commands for Wordpress theme development.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```$ gem install wp_scaffold```
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
To create a new theme:
|
12
|
+
|
13
|
+
```wp new "theme name"```
|
14
|
+
|
15
|
+
```cd theme_name```
|
16
|
+
|
17
|
+
To create a custom post type:
|
18
|
+
|
19
|
+
```wp cpt "Post Type Name"```
|
20
|
+
|
21
|
+
Make sure that your custom post type name is singular; wp_scaffold with take care of pluralizing it for you.
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/wp
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'wp_scaffold'
|
4
|
+
|
5
|
+
case ARGV[0]
|
6
|
+
|
7
|
+
when "new"
|
8
|
+
gen = WpScaffold::Generator.new
|
9
|
+
# Pass the theme name as ARGV[1]
|
10
|
+
gen.create_theme(ARGV[1])
|
11
|
+
when "cpt"
|
12
|
+
gen = WpScaffold::Generator.new
|
13
|
+
# Pass the theme name as ARGV[1]
|
14
|
+
gen.create_custom_post_type(ARGV[1])
|
15
|
+
else
|
16
|
+
message = WpScaffold::Generator.new
|
17
|
+
message.usage
|
18
|
+
end
|
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,81 @@
|
|
1
|
+
class WpScaffold::Generator
|
2
|
+
|
3
|
+
def create_theme(theme_name)
|
4
|
+
theme_name = 'New Theme' if theme_name.nil?
|
5
|
+
|
6
|
+
if File.directory?(current_dir + "/" + theme_name.to_underscore)
|
7
|
+
puts "There is already a theme called #{theme_name}."
|
8
|
+
else
|
9
|
+
|
10
|
+
# Copy the directory
|
11
|
+
cp_r file_base + "/templates/theme_base", current_dir + "/"
|
12
|
+
|
13
|
+
# Rename it
|
14
|
+
File.rename current_dir + "/theme_base", current_dir + "/" + theme_name.to_underscore
|
15
|
+
|
16
|
+
|
17
|
+
# Add the name of the theme to the files, where necessary
|
18
|
+
file_names = ['style.css', 'styles/style.scss']
|
19
|
+
|
20
|
+
file_names.each do |file_name|
|
21
|
+
file_name = current_dir + "/" + theme_name.to_underscore + "/" + file_name
|
22
|
+
file_text = File.read(file_name).gsub("___THEME_NAME___", theme_name)
|
23
|
+
File.open(file_name, "w") {|file| file.puts file_text}
|
24
|
+
end
|
25
|
+
|
26
|
+
puts "Created the theme #{theme_name}. run 'cd #{theme_name.to_underscore}'."
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
def create_custom_post_type(cpt_name)
|
33
|
+
# Grab out template, and use it to create our cpt object
|
34
|
+
new_cpt = File.read(file_base + "/templates/custom_post_type/register-cpt.php")
|
35
|
+
new_cpt = new_cpt.gsub("___CPT_CAPITALIZED___", cpt_name.titleize)
|
36
|
+
new_cpt = new_cpt.gsub("___CPT_UNDERSCORED___", cpt_name.to_underscore)
|
37
|
+
new_cpt = new_cpt.gsub("___CPT_CAPITALIZED_PLURAL___", cpt_name.titleize.pluralize)
|
38
|
+
new_cpt = new_cpt.gsub("___CPT_DOWNCASE_PLURAL___", cpt_name.pluralize.downcase)
|
39
|
+
|
40
|
+
# Append the new custom post type "custom-post-types.php". Crate the file if it doesn't already exist.
|
41
|
+
File.open(current_dir + "/functions/custom-post-type.php", 'a') {|f| f.write(new_cpt) }
|
42
|
+
|
43
|
+
|
44
|
+
# Create the Page Template
|
45
|
+
page_template = File.read(file_base + "/templates/custom_post_type/page-custom.php")
|
46
|
+
page_template = page_template.gsub("___CPT_NAME_DASHED_PLURAL___", cpt_name.pluralize.to_underscore.dasherize)
|
47
|
+
page_template = page_template.gsub("___CPT_NAME___", cpt_name.titleize)
|
48
|
+
page_template = page_template.gsub("___CPT_NAME_PLURAL___", cpt_name.pluralize.titleize)
|
49
|
+
page_template = page_template.gsub("___CPT_NAME_UNDERSCORED___", cpt_name.to_underscore)
|
50
|
+
|
51
|
+
File.open(current_dir + "/page-" + cpt_name.pluralize.to_underscore.dasherize + ".php", 'w') {|f| f.write(page_template) }
|
52
|
+
|
53
|
+
|
54
|
+
# Create the Single Template
|
55
|
+
single_template = File.read(file_base + "/templates/custom_post_type/single-custom.php")
|
56
|
+
single_template = single_template.gsub("___CPT_NAME_DASHED___", cpt_name.to_underscore.dasherize)
|
57
|
+
single_template = single_template.gsub("___CPT_NAME___", cpt_name.titleize)
|
58
|
+
|
59
|
+
File.open(current_dir + "/single-" + cpt_name.to_underscore.dasherize + ".php", 'w') {|f| f.write(single_template) }
|
60
|
+
|
61
|
+
puts "Created new post type '#{cpt_name.pluralize}'."
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
def usage
|
66
|
+
file = File.open("#{File.expand_path(File.dirname(__FILE__))}/usage.txt", "rb")
|
67
|
+
puts file.read
|
68
|
+
file.close
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def current_dir
|
74
|
+
Dir.pwd
|
75
|
+
end
|
76
|
+
|
77
|
+
def file_base
|
78
|
+
File.expand_path(File.dirname(__FILE__))
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
Binary file
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<?php /* Template Name: ___CPT_NAME___ Index */ ?>
|
2
|
+
<!-- This is the page-___CPT_NAME_DASHED_PLURAL___.php file, a page template that lists out "___CPT_NAME___" posts -->
|
3
|
+
|
4
|
+
<?php get_header(); ?>
|
5
|
+
|
6
|
+
<section>
|
7
|
+
<!-- Start Loop -->
|
8
|
+
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
9
|
+
|
10
|
+
<div class="breadcrumbs">
|
11
|
+
<?php get_breadcrumbs($post); ?>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<h1><?php the_title(); ?></h1>
|
15
|
+
<?php the_content(); ?>
|
16
|
+
|
17
|
+
|
18
|
+
<?php // List all posts with type "___CPT_NAME_UNDERSCORED___"
|
19
|
+
$args = array(
|
20
|
+
'post_type' => '___CPT_NAME_UNDERSCORED___'
|
21
|
+
);
|
22
|
+
|
23
|
+
$___CPT_NAME_UNDERSCORED____query = new WP_Query( $args );
|
24
|
+
?>
|
25
|
+
|
26
|
+
<!-- Start ___CPT_NAME___ Loop -->
|
27
|
+
<?php if ( have_posts() ) : ?>
|
28
|
+
|
29
|
+
<ul>
|
30
|
+
<?php while ( $___CPT_NAME_UNDERSCORED____query->have_posts() ) : $___CPT_NAME_UNDERSCORED____query->the_post(); ?>
|
31
|
+
|
32
|
+
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
|
33
|
+
|
34
|
+
<?php endwhile; ?>
|
35
|
+
</ul>
|
36
|
+
|
37
|
+
<?php else: ?>
|
38
|
+
<p>No ___CPT_NAME_PLURAL___ to display!</p>
|
39
|
+
<?php endif; ?>
|
40
|
+
<?php wp_reset_postdata(); ?>
|
41
|
+
<!-- End ___CPT_NAME___ Loop -->
|
42
|
+
|
43
|
+
|
44
|
+
<?php endwhile; else: ?>
|
45
|
+
<p>Page not found!</p>
|
46
|
+
<?php endif; ?>
|
47
|
+
<!-- End Loop -->
|
48
|
+
</section>
|
49
|
+
|
50
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
// ___CPT_CAPITALIZED_PLURAL___
|
4
|
+
add_action('init', 'create____CPT_UNDERSCORED____post_type');
|
5
|
+
function create____CPT_UNDERSCORED____post_type() {
|
6
|
+
register_post_type( '___CPT_UNDERSCORED___',
|
7
|
+
array(
|
8
|
+
'labels' => array(
|
9
|
+
'name' => __( '___CPT_CAPITALIZED_PLURAL___' ),
|
10
|
+
'singular_name' => __( '___CPT_CAPITALIZED___' ),
|
11
|
+
'add_new' => __( 'Add New ___CPT_CAPITALIZED___' ),
|
12
|
+
'add_new_item' => __( 'Add New ___CPT_CAPITALIZED___' ),
|
13
|
+
'edit_item' => __( 'Edit ___CPT_CAPITALIZED___' ),
|
14
|
+
'new_item' => __( 'Add New ___CPT_CAPITALIZED___' ),
|
15
|
+
'view_item' => __( 'View ___CPT_CAPITALIZED___' ),
|
16
|
+
'search_items' => __( 'Search ___CPT_CAPITALIZED_PLURAL___' ),
|
17
|
+
'not_found' => __( 'No ___CPT_DOWNCASE_PLURAL___ found' ),
|
18
|
+
'not_found_in_trash' => __( 'No ___CPT_DOWNCASE_PLURAL___ found in trash'),
|
19
|
+
'menu_name' => __( '___CPT_CAPITALIZED_PLURAL___' ),
|
20
|
+
),
|
21
|
+
'public' => true,
|
22
|
+
'rewrite' => array('slug' => '___CPT_UNDERSCORED___'),
|
23
|
+
//'taxonomies' => array('category'),
|
24
|
+
'publicly_queryable' => true,
|
25
|
+
'supports' => array('title', 'editor', 'page-attributes')
|
26
|
+
)
|
27
|
+
);
|
28
|
+
}
|
29
|
+
|
30
|
+
?>
|
31
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!-- This is the single-___CPT_NAME_DASHED___.php file, which acts as a template for a single "___CPT_NAME___" post type -->
|
2
|
+
|
3
|
+
<?php get_header(); ?>
|
4
|
+
|
5
|
+
<section>
|
6
|
+
<!-- Start Loop -->
|
7
|
+
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
8
|
+
|
9
|
+
<h1><?php the_title(); ?></h1>
|
10
|
+
<?php the_content(); ?>
|
11
|
+
|
12
|
+
<?php endwhile; else: ?>
|
13
|
+
<p>___CPT_NAME___ not found!</p>
|
14
|
+
<?php endif; ?>
|
15
|
+
<!-- End Loop -->
|
16
|
+
</section>
|
17
|
+
|
18
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!-- This is the category.php file, which shows all posts in a particular category -->
|
2
|
+
|
3
|
+
<?php get_header(); ?>
|
4
|
+
|
5
|
+
<section>
|
6
|
+
<h1>Category: <?php single_cat_title(); ?></h1>
|
7
|
+
|
8
|
+
<!-- Start Loop -->
|
9
|
+
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
10
|
+
|
11
|
+
<?php get_template_part( 'partials/content', 'post' ); ?>
|
12
|
+
|
13
|
+
<?php endwhile; else: ?>
|
14
|
+
<p>No Posts to display!</p>
|
15
|
+
<?php endif; ?>
|
16
|
+
<!-- End Loop -->
|
17
|
+
</section>
|
18
|
+
|
19
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!-- This is the front-page.php file, which should act as the static homepage -->
|
2
|
+
|
3
|
+
<?php get_header(); ?>
|
4
|
+
|
5
|
+
<section>
|
6
|
+
<!-- Start Loop -->
|
7
|
+
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
8
|
+
|
9
|
+
<h1><?php the_title(); ?></h1>
|
10
|
+
<?php the_content(); ?>
|
11
|
+
|
12
|
+
<?php endwhile; else: ?>
|
13
|
+
<p>Page not found!</p>
|
14
|
+
<?php endif; ?>
|
15
|
+
<!-- End Loop -->
|
16
|
+
</section>
|
17
|
+
|
18
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
function get_breadcrumbs($post) {
|
4
|
+
$breadcrumbs = '<li class="current">'.$post->post_title.'</li></ul>';
|
5
|
+
$current_post = $post;
|
6
|
+
|
7
|
+
do {
|
8
|
+
if( $current_post->post_parent ) {
|
9
|
+
$has_parent = true;
|
10
|
+
$current_post = get_post($current_post->post_parent);
|
11
|
+
$breadcrumbs = '<li><a href="'.get_permalink($current_post->ID).'">'.$current_post->post_title.'</a></li>' . $breadcrumbs;
|
12
|
+
} else {
|
13
|
+
$has_parent = false;
|
14
|
+
}
|
15
|
+
} while ($has_parent);
|
16
|
+
|
17
|
+
$breadcrumbs = '<li><a href="'.get_bloginfo('url').'">Home</a></li>' . $breadcrumbs;
|
18
|
+
$breadcrumbs = '<ul class="breadcrumbs-nav">' . $breadcrumbs;
|
19
|
+
|
20
|
+
echo $breadcrumbs;
|
21
|
+
}
|
22
|
+
|
23
|
+
?>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
|
4
|
+
# Theme Settings Menu
|
5
|
+
add_action('admin_menu', 'create_theme_settings_menu');
|
6
|
+
|
7
|
+
# Add the menu item
|
8
|
+
function create_theme_settings_menu() {
|
9
|
+
add_menu_page('Theme Settings', 'Theme Settings', 'administrator', __FILE__, 'theme_settings_page', site_url()."/wp-admin/images/media-button-other.gif");
|
10
|
+
add_action('admin_init', 'register_theme_settings');
|
11
|
+
}
|
12
|
+
|
13
|
+
# Register our settings
|
14
|
+
function register_theme_settings() {
|
15
|
+
register_setting('custom-settings-group', 'phone_number');
|
16
|
+
register_setting('custom-settings-group', 'support_email');
|
17
|
+
# register_setting('custom-settings-group', 'ANOTHER_CUSTOM_SETTING');
|
18
|
+
}
|
19
|
+
|
20
|
+
# Create the admin screen
|
21
|
+
function theme_settings_page() { ?>
|
22
|
+
<div class="custom-theme-settings-wrap">
|
23
|
+
<h1>Theme Settings</h1>
|
24
|
+
<form method="post" action="options.php">
|
25
|
+
<?php settings_fields('custom-settings-group'); ?>
|
26
|
+
|
27
|
+
|
28
|
+
<div class="group">
|
29
|
+
<h2>Contact Info</h2>
|
30
|
+
|
31
|
+
<fieldset>
|
32
|
+
<label>Phone Number</label>
|
33
|
+
<input type="text" name="phone_number" plcaeholder="1.800.000.0000" value="<?php echo get_option('phone_number'); ?>"/>
|
34
|
+
</fieldset>
|
35
|
+
|
36
|
+
<fieldset>
|
37
|
+
<label>Support Email Address</label>
|
38
|
+
<input type="text" name="support_email" placeholder="name@example.com" value="<?php echo get_option('support_email'); ?>"/>
|
39
|
+
</fieldset>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
|
43
|
+
<div class="controlls">
|
44
|
+
<?php submit_button(); ?>
|
45
|
+
</div>
|
46
|
+
</form>
|
47
|
+
</div>
|
48
|
+
<?php }
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
# Custom stylesheet for admin screens
|
53
|
+
function admin_theme_style() {
|
54
|
+
wp_enqueue_style('admin-theme', get_template_directory_uri() . '/wp-admin.css');
|
55
|
+
}
|
56
|
+
add_action('admin_enqueue_scripts', 'admin_theme_style');
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
?>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<?php
|
2
|
+
|
3
|
+
# Enable custom menus
|
4
|
+
add_theme_support( 'menus' );
|
5
|
+
register_nav_menus( array(
|
6
|
+
'header_menu' => 'Header Menu',
|
7
|
+
'footer_menu' => 'Footer Menu'
|
8
|
+
) );
|
9
|
+
|
10
|
+
|
11
|
+
# Enable featured images
|
12
|
+
add_theme_support( 'post-thumbnails' );
|
13
|
+
|
14
|
+
|
15
|
+
# Stylesheets
|
16
|
+
function theme_styles() {
|
17
|
+
wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );
|
18
|
+
}
|
19
|
+
add_action( 'wp_enqueue_scripts', 'theme_styles' );
|
20
|
+
|
21
|
+
|
22
|
+
# Javascripts
|
23
|
+
function theme_js() {
|
24
|
+
# Auto-serve retina @2x images - github.com/imulus/retinajs
|
25
|
+
# wp_enqueue_script( 'retina', get_template_directory_uri() . '/js/vendor/retina-1.1.0.min.js', array('jquery'), '', true );
|
26
|
+
|
27
|
+
# Remove 200ms delay on mobile safari - github.com/ftlabs/fastclick
|
28
|
+
# wp_enqueue_script( 'fastclick', get_template_directory_uri() . '/js/vendor/fastclick.js', array('jquery'), '', true );
|
29
|
+
|
30
|
+
# Easily style select inputs - github.com/patrickkunka/easydropdown
|
31
|
+
# wp_enqueue_script( 'easy-dropdown', get_template_directory_uri() . '/js/vendor/jquery.easydropdown.min.js', array('jquery'), '', true );
|
32
|
+
|
33
|
+
# Our theme's main javascript
|
34
|
+
wp_enqueue_script( 'main', get_template_directory_uri() . '/js/main.js', array('jquery'), '', true );
|
35
|
+
}
|
36
|
+
add_action( 'wp_enqueue_scripts', 'theme_js' );
|
37
|
+
|
38
|
+
|
39
|
+
# Include all PHP files from "functions" directory
|
40
|
+
foreach ( glob("functions/*.php") as $filename ) {
|
41
|
+
include $filename;
|
42
|
+
}
|
43
|
+
|
44
|
+
?>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
6
|
+
|
7
|
+
<title><?php bloginfo( 'name' ); ?><?php wp_title( '|' ); ?></title>
|
8
|
+
|
9
|
+
<!-- Favicon -->
|
10
|
+
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />
|
11
|
+
|
12
|
+
<?php wp_head(); ?>
|
13
|
+
|
14
|
+
<!-- HTML5 Shiv -->
|
15
|
+
<!--[if lt IE 9]>
|
16
|
+
<script src="<?php bloginfo('template_directory'); ?>/js/vendor/html5shiv.js"></script>
|
17
|
+
<![endif]-->
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
|
21
|
+
<header>
|
22
|
+
<nav>
|
23
|
+
<?php
|
24
|
+
// Display Header Menu
|
25
|
+
$defaults = array('theme_location' => 'header_menu');
|
26
|
+
wp_nav_menu( $defaults );
|
27
|
+
?>
|
28
|
+
</nav>
|
29
|
+
</header>
|
30
|
+
|
31
|
+
<main>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!-- This is the home.php file, which is essentially the "blog" page -->
|
2
|
+
|
3
|
+
<?php get_header(); ?>
|
4
|
+
|
5
|
+
<section>
|
6
|
+
<!-- Start Loop -->
|
7
|
+
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
8
|
+
|
9
|
+
<?php get_template_part( 'partials/content', 'post' ); ?>
|
10
|
+
|
11
|
+
<?php endwhile; else: ?>
|
12
|
+
<p>No Posts to display!</p>
|
13
|
+
<?php endif; ?>
|
14
|
+
<!-- End Loop -->
|
15
|
+
</section>
|
16
|
+
|
17
|
+
<?php get_footer(); ?>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!-- This is the index.php file, which acts as a fallback if no other templates are found -->
|
2
|
+
|
3
|
+
<?php get_header(); ?>
|
4
|
+
|
5
|
+
<section>
|
6
|
+
<!-- Start Loop -->
|
7
|
+
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
8
|
+
|
9
|
+
<h1><?php the_title(); ?></h1>
|
10
|
+
<?php the_content(); ?>
|
11
|
+
|
12
|
+
<?php endwhile; else: ?>
|
13
|
+
<p>Post not found!</p>
|
14
|
+
<?php endif; ?>
|
15
|
+
<!-- End Loop -->
|
16
|
+
</section>
|
17
|
+
|
18
|
+
<?php get_footer(); ?>
|