fones 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -1
- data/Gemfile +14 -14
- data/Gemfile.lock +85 -49
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/features/step_definitions/fones_steps.rb +2 -2
- data/fones.gemspec +72 -62
- data/layouts/config/config.tt +37 -1
- data/layouts/default/functions/functions.php.erb +92 -93
- data/layouts/default/functions/library/admin.php.erb +18 -24
- data/layouts/default/functions/library/bones.php.erb +205 -201
- data/layouts/default/functions/library/custom-post-type.php.erb +103 -104
- data/layouts/default/functions/library/translation/de_DE.mo +0 -0
- data/layouts/default/functions/library/translation/default.mo +0 -0
- data/layouts/default/functions/library/translation/default.po +4 -5
- data/layouts/default/functions/library/translation/es_ES.mo +0 -0
- data/layouts/default/functions/library/translation/fr_FR.mo +0 -0
- data/layouts/default/functions/library/translation/he_IL.mo +0 -0
- data/layouts/default/functions/library/translation/hr.mo +0 -0
- data/layouts/default/functions/library/translation/it_IT.mo +0 -0
- data/layouts/default/functions/library/translation/ja.mo +0 -0
- data/layouts/default/functions/library/translation/nb_NO.mo +0 -0
- data/layouts/default/functions/library/translation/nl_NL.mo +0 -0
- data/layouts/default/functions/library/translation/pl_PL.mo +0 -0
- data/layouts/default/functions/library/translation/pt_PT.mo +0 -0
- data/layouts/default/functions/library/translation/ru_RU.mo +0 -0
- data/layouts/default/functions/library/translation/sv_SE.mo +0 -0
- data/layouts/default/functions/library/translation/translation.php.erb +5 -5
- data/layouts/default/functions/library/translation/zh_CN.mo +0 -0
- data/lib/fones.rb +7 -7
- data/lib/{forge → fones}/builder.rb +1 -2
- data/lib/{forge → fones}/cli.rb +5 -5
- data/lib/{forge → fones}/config.rb +12 -5
- data/lib/{forge → fones}/error.rb +0 -0
- data/lib/{forge → fones}/generator.rb +1 -2
- data/lib/{forge → fones}/guard.rb +4 -4
- data/lib/{forge → fones}/project.rb +2 -2
- data/lib/{forge → fones}/version.rb +0 -0
- data/lib/guard/{forge → fones}/assets.rb +1 -1
- data/lib/guard/{forge → fones}/config.rb +1 -1
- data/lib/guard/{forge → fones}/functions.rb +0 -0
- data/lib/guard/{forge → fones}/templates.rb +1 -1
- data/spec/lib/{forge → fones}/config_spec.rb +5 -4
- data/spec/lib/{forge → fones}/project_spec.rb +6 -6
- data/spec/spec_helper.rb +2 -3
- metadata +68 -110
- data/lib/forge/engines.rb +0 -12
- data/pkg/fones-0.1.0.gem +0 -0
data/layouts/config/config.tt
CHANGED
@@ -16,4 +16,40 @@
|
|
16
16
|
# end
|
17
17
|
|
18
18
|
# You can also include additional Compass frameworks by requiring them:
|
19
|
-
# require 'stitch'
|
19
|
+
# require 'stitch'
|
20
|
+
|
21
|
+
|
22
|
+
# Theme Customisation, these values will be used troughout the theme
|
23
|
+
|
24
|
+
# Theme Name
|
25
|
+
# config[:name] = "Your Awesome Theme Name"
|
26
|
+
|
27
|
+
# Theme URI
|
28
|
+
# config[:uri] = "http://yourtheme.com"
|
29
|
+
|
30
|
+
# Author
|
31
|
+
# config[:author] = "your name"
|
32
|
+
|
33
|
+
# Author URI
|
34
|
+
# config[:author_uri] = "http://yoururl.com"
|
35
|
+
|
36
|
+
# Description
|
37
|
+
# config[:description] = "What is this theme all about?"
|
38
|
+
|
39
|
+
# Version
|
40
|
+
# config[:version_number] = "Your theme version"
|
41
|
+
|
42
|
+
# Template (the parent theme your using)
|
43
|
+
# config[:template] = "twenty-thirteen"
|
44
|
+
|
45
|
+
# License
|
46
|
+
# config[:license_name] = "MIT"
|
47
|
+
|
48
|
+
# License URI
|
49
|
+
# config[:license_uri] = "http://opensource.org/licenses/MIT"
|
50
|
+
|
51
|
+
# Tags
|
52
|
+
# config[:tags] = "Responsive, SASS, Clean, Fast, etc.."
|
53
|
+
|
54
|
+
# Comments
|
55
|
+
# config[:comments] = ""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<?php
|
2
2
|
/*
|
3
|
-
Author:
|
4
|
-
URL:
|
3
|
+
Author: <YOUR_NAME_HERE>
|
4
|
+
URL: <YOUR_URL_HERE>
|
5
5
|
|
6
6
|
This is where you can drop your custom functions or
|
7
7
|
just edit things like thumbnail sizes, header images,
|
@@ -12,37 +12,36 @@ sidebars, comments, ect.
|
|
12
12
|
|
13
13
|
/*
|
14
14
|
1. library/bones.php
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
- customizing the post excerpt
|
23
|
-
- custom google+ integration
|
24
|
-
- adding custom fields to user profiles
|
15
|
+
- head cleanup (remove rsd, uri links, junk css, ect)
|
16
|
+
- enqueueing scripts & styles
|
17
|
+
- theme support functions
|
18
|
+
- custom menu output & fallbacks
|
19
|
+
- related post function
|
20
|
+
- page-navi function
|
21
|
+
- removing <p> from around images
|
22
|
+
- customizing the post excerpt
|
23
|
+
- custom google+ integration
|
24
|
+
- adding custom fields to user profiles
|
25
25
|
*/
|
26
26
|
require_once('library/bones.php'); // if you remove this, <%= theme_id %> will break
|
27
|
-
|
28
27
|
/*
|
29
28
|
2. library/custom-post-type.php
|
30
|
-
- an example custom post type
|
31
|
-
- example custom taxonomy (like categories)
|
32
|
-
- example custom taxonomy (like tags)
|
29
|
+
- an example custom post type
|
30
|
+
- example custom taxonomy (like categories)
|
31
|
+
- example custom taxonomy (like tags)
|
33
32
|
*/
|
34
33
|
require_once('library/custom-post-type.php'); // you can disable this if you like
|
35
34
|
/*
|
36
35
|
3. library/admin.php
|
37
|
-
- removing some default WordPress dashboard widgets
|
38
|
-
- an example custom dashboard widget
|
39
|
-
- adding custom login css
|
40
|
-
- changing text in footer of admin
|
36
|
+
- removing some default WordPress dashboard widgets
|
37
|
+
- an example custom dashboard widget
|
38
|
+
- adding custom login css
|
39
|
+
- changing text in footer of admin
|
41
40
|
*/
|
42
41
|
// require_once('library/admin.php'); // this comes turned off by default
|
43
42
|
/*
|
44
43
|
4. library/translation/translation.php
|
45
|
-
- adding support for other languages
|
44
|
+
- adding support for other languages
|
46
45
|
*/
|
47
46
|
// require_once('library/translation/translation.php'); // this comes turned off by default
|
48
47
|
|
@@ -75,78 +74,78 @@ you like. Enjoy!
|
|
75
74
|
|
76
75
|
// Sidebars & Widgetizes Areas
|
77
76
|
function <%= theme_id %>_register_sidebars() {
|
78
|
-
register_sidebar(array(
|
79
|
-
'id' => 'sidebar1',
|
80
|
-
'name' => __('Sidebar 1', '<%= theme_id %>theme'),
|
81
|
-
'description' => __('The first (primary) sidebar.', '<%= theme_id %>theme'),
|
82
|
-
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
83
|
-
|
84
|
-
'before_title' => '<h4 class="widgettitle">',
|
85
|
-
|
86
|
-
));
|
87
|
-
|
88
|
-
/*
|
89
|
-
to add more sidebars or widgetized areas, just copy
|
90
|
-
and edit the above sidebar code. In order to call
|
91
|
-
your new sidebar just use the following code:
|
92
|
-
|
93
|
-
Just change the name to whatever your new
|
94
|
-
sidebar's id is, for example:
|
95
|
-
|
96
|
-
register_sidebar(array(
|
97
|
-
'id' => 'sidebar2',
|
98
|
-
'name' => __('Sidebar 2', '<%= theme_id %>theme'),
|
99
|
-
'description' => __('The second (secondary) sidebar.', '<%= theme_id %>theme'),
|
100
|
-
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
101
|
-
|
102
|
-
'before_title' => '<h4 class="widgettitle">',
|
103
|
-
|
104
|
-
));
|
105
|
-
|
106
|
-
To call the sidebar in your template, you can just copy
|
107
|
-
the sidebar.php file and rename it to your sidebar's name.
|
108
|
-
So using the above example, it would be:
|
109
|
-
sidebar-sidebar2.php
|
110
|
-
|
111
|
-
*/
|
77
|
+
register_sidebar(array(
|
78
|
+
'id' => 'sidebar1',
|
79
|
+
'name' => __('Sidebar 1', '<%= theme_id %>theme'),
|
80
|
+
'description' => __('The first (primary) sidebar.', '<%= theme_id %>theme'),
|
81
|
+
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
82
|
+
'after_widget' => '</div>',
|
83
|
+
'before_title' => '<h4 class="widgettitle">',
|
84
|
+
'after_title' => '</h4>',
|
85
|
+
));
|
86
|
+
|
87
|
+
/*
|
88
|
+
to add more sidebars or widgetized areas, just copy
|
89
|
+
and edit the above sidebar code. In order to call
|
90
|
+
your new sidebar just use the following code:
|
91
|
+
|
92
|
+
Just change the name to whatever your new
|
93
|
+
sidebar's id is, for example:
|
94
|
+
|
95
|
+
register_sidebar(array(
|
96
|
+
'id' => 'sidebar2',
|
97
|
+
'name' => __('Sidebar 2', '<%= theme_id %>theme'),
|
98
|
+
'description' => __('The second (secondary) sidebar.', '<%= theme_id %>theme'),
|
99
|
+
'before_widget' => '<div id="%1$s" class="widget %2$s">',
|
100
|
+
'after_widget' => '</div>',
|
101
|
+
'before_title' => '<h4 class="widgettitle">',
|
102
|
+
'after_title' => '</h4>',
|
103
|
+
));
|
104
|
+
|
105
|
+
To call the sidebar in your template, you can just copy
|
106
|
+
the sidebar.php file and rename it to your sidebar's name.
|
107
|
+
So using the above example, it would be:
|
108
|
+
sidebar-sidebar2.php
|
109
|
+
|
110
|
+
*/
|
112
111
|
} // don't remove this bracket!
|
113
112
|
|
114
113
|
/************* COMMENT LAYOUT *********************/
|
115
114
|
|
116
115
|
// Comment Layout
|
117
116
|
function <%= theme_id %>_comments($comment, $args, $depth) {
|
118
|
-
$GLOBALS['comment'] = $comment; ?>
|
119
|
-
<li <?php comment_class(); ?>>
|
120
|
-
<article id="comment-<?php comment_ID(); ?>" class="clearfix">
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
</article>
|
149
|
-
<!-- </li> is added by WordPress automatically -->
|
117
|
+
$GLOBALS['comment'] = $comment; ?>
|
118
|
+
<li <?php comment_class(); ?>>
|
119
|
+
<article id="comment-<?php comment_ID(); ?>" class="clearfix">
|
120
|
+
<header class="comment-author vcard">
|
121
|
+
<?php
|
122
|
+
/*
|
123
|
+
this is the new responsive optimized comment image. It used the new HTML5 data-attribute to display comment gravatars on larger screens only. What this means is that on larger posts, mobile sites don't have a ton of requests for comment images. This makes load time incredibly fast! If you'd like to change it back, just replace it with the regular wordpress gravatar call:
|
124
|
+
echo get_avatar($comment,$size='32',$default='<path_to_url>' );
|
125
|
+
*/
|
126
|
+
?>
|
127
|
+
<!-- custom gravatar call -->
|
128
|
+
<?php
|
129
|
+
// create variable
|
130
|
+
$bgauthemail = get_comment_author_email();
|
131
|
+
?>
|
132
|
+
<img data-gravatar="http://www.gravatar.com/avatar/<?php echo md5($bgauthemail); ?>?s=32" class="load-gravatar avatar avatar-48 photo" height="32" width="32" src="<?php echo get_template_directory_uri(); ?>/library/images/nothing.gif" />
|
133
|
+
<!-- end custom gravatar call -->
|
134
|
+
<?php printf(__('<cite class="fn">%s</cite>', '<%= theme_id %>theme'), get_comment_author_link()) ?>
|
135
|
+
<time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time(__('F jS, Y', '<%= theme_id %>theme')); ?> </a></time>
|
136
|
+
<?php edit_comment_link(__('(Edit)', '<%= theme_id %>theme'),' ','') ?>
|
137
|
+
</header>
|
138
|
+
<?php if ($comment->comment_approved == '0') : ?>
|
139
|
+
<div class="alert alert-info">
|
140
|
+
<p><?php _e('Your comment is awaiting moderation.', '<%= theme_id %>theme') ?></p>
|
141
|
+
</div>
|
142
|
+
<?php endif; ?>
|
143
|
+
<section class="comment_content clearfix">
|
144
|
+
<?php comment_text() ?>
|
145
|
+
</section>
|
146
|
+
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
|
147
|
+
</article>
|
148
|
+
<!-- </li> is added by WordPress automatically -->
|
150
149
|
<?php
|
151
150
|
} // don't remove this bracket!
|
152
151
|
|
@@ -154,12 +153,12 @@ $GLOBALS['comment'] = $comment; ?>
|
|
154
153
|
|
155
154
|
// Search Form
|
156
155
|
function <%= theme_id %>_wpsearch($form) {
|
157
|
-
|
158
|
-
<label class="screen-reader-text" for="s">' . __('Search for:', '<%= theme_id %>theme') . '</label>
|
159
|
-
<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="'.esc_attr__('Search the Site...','<%= theme_id %>theme').'" />
|
160
|
-
<input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
|
161
|
-
</form>';
|
162
|
-
return $form;
|
156
|
+
$form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
|
157
|
+
<label class="screen-reader-text" for="s">' . __('Search for:', '<%= theme_id %>theme') . '</label>
|
158
|
+
<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="'.esc_attr__('Search the Site...','<%= theme_id %>theme').'" />
|
159
|
+
<input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" />
|
160
|
+
</form>';
|
161
|
+
return $form;
|
163
162
|
} // don't remove this bracket!
|
164
163
|
|
165
164
|
|
@@ -6,8 +6,8 @@ dashboard. Updates to this page are coming soon.
|
|
6
6
|
It's turned off by default, but you can call it
|
7
7
|
via the functions file.
|
8
8
|
|
9
|
-
Developed by:
|
10
|
-
URL:
|
9
|
+
Developed by: <%= config[:author] %>
|
10
|
+
URL: <%= config[:author_uri] %>
|
11
11
|
|
12
12
|
Special Thanks for code & inspiration to:
|
13
13
|
@jackmcconnell - http://www.voltronik.co.uk/
|
@@ -32,12 +32,6 @@ function disable_default_dashboard_widgets() {
|
|
32
32
|
// removing plugin dashboard boxes
|
33
33
|
remove_meta_box('yoast_db_widget', 'dashboard', 'normal'); // Yoast's SEO Plugin Widget
|
34
34
|
|
35
|
-
/*
|
36
|
-
have more plugin widgets you'd like to remove?
|
37
|
-
share them with us so we can get a list of
|
38
|
-
the most commonly used. :D
|
39
|
-
https://github.com/eddiemachado/bones/issues
|
40
|
-
*/
|
41
35
|
}
|
42
36
|
|
43
37
|
/*
|
@@ -57,20 +51,20 @@ function <%= theme_id %>_rss_dashboard_widget() {
|
|
57
51
|
include_once(ABSPATH . WPINC . '/feed.php'); // include the required file
|
58
52
|
$feed = fetch_feed('http://themble.com/feed/rss/'); // specify the source feed
|
59
53
|
$limit = $feed->get_item_quantity(7); // specify number of items
|
60
|
-
$items = $feed->get_items(0, $limit); // create an array of items
|
61
|
-
}
|
62
|
-
if ($limit == 0) echo '<div>The RSS Feed is either empty or unavailable.</div>'; // fallback message
|
63
|
-
else foreach ($items as $item) { ?>
|
64
|
-
|
65
|
-
<h4 style="margin-bottom: 0;">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
</h4>
|
70
|
-
<p style="margin-top: 0.5em;">
|
71
|
-
|
72
|
-
</p>
|
73
|
-
<?php }
|
54
|
+
$items = $feed->get_items(0, $limit); // create an array of items
|
55
|
+
}
|
56
|
+
if ($limit == 0) echo '<div>The RSS Feed is either empty or unavailable.</div>'; // fallback message
|
57
|
+
else foreach ($items as $item) { ?>
|
58
|
+
|
59
|
+
<h4 style="margin-bottom: 0;">
|
60
|
+
<a href="<?php echo $item->get_permalink(); ?>" title="<?php echo mysql2date(__('j F Y @ g:i a', '<%= theme_id %>theme'), $item->get_date('Y-m-d H:i:s')); ?>" target="_blank">
|
61
|
+
<?php echo $item->get_title(); ?>
|
62
|
+
</a>
|
63
|
+
</h4>
|
64
|
+
<p style="margin-top: 0.5em;">
|
65
|
+
<?php echo substr($item->get_description(), 0, 200); ?>
|
66
|
+
</p>
|
67
|
+
<?php }
|
74
68
|
}
|
75
69
|
|
76
70
|
// calling all custom dashboard widgets
|
@@ -96,7 +90,7 @@ add_action('wp_dashboard_setup', '<%= theme_id %>_custom_dashboard_widgets');
|
|
96
90
|
//Updated to proper 'enqueue' method
|
97
91
|
//http://codex.wordpress.org/Plugin_API/Action_Reference/login_enqueue_scripts
|
98
92
|
function <%= theme_id %>_login_css() {
|
99
|
-
wp_enqueue_style( '<%= theme_id %>_login_css', get_template_directory_uri() . '/css/login.css', false );
|
93
|
+
wp_enqueue_style( '<%= theme_id %>_login_css', get_template_directory_uri() . '/library/css/login.css', false );
|
100
94
|
}
|
101
95
|
|
102
96
|
// changing the logo link from wordpress.org to your site
|
@@ -128,4 +122,4 @@ function <%= theme_id %>_custom_admin_footer() {
|
|
128
122
|
// adding it to the admin area
|
129
123
|
add_filter('admin_footer_text', '<%= theme_id %>_custom_admin_footer');
|
130
124
|
|
131
|
-
?>
|
125
|
+
?>
|
@@ -1,16 +1,16 @@
|
|
1
1
|
<?php
|
2
|
-
/* Welcome to
|
3
|
-
This is the core
|
2
|
+
/* Welcome to <%= theme_id %> :)
|
3
|
+
This is the core <%= theme_id %> file where most of the
|
4
4
|
main functions & features reside. If you have
|
5
5
|
any custom functions, it's best to put them
|
6
6
|
in the functions.php file.
|
7
7
|
|
8
|
-
Developed by:
|
9
|
-
URL:
|
8
|
+
Developed by: <%= config[:author] %>
|
9
|
+
URL: <%= config[:author_uri] %>
|
10
10
|
*/
|
11
11
|
|
12
12
|
/*********************
|
13
|
-
LAUNCH
|
13
|
+
LAUNCH <%= theme_id %>
|
14
14
|
Let's fire off all the functions
|
15
15
|
and tools. I put it up here so it's
|
16
16
|
right up top and clean.
|
@@ -60,24 +60,24 @@ need.
|
|
60
60
|
*********************/
|
61
61
|
|
62
62
|
function <%= theme_id %>_head_cleanup() {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
63
|
+
// category feeds
|
64
|
+
// remove_action( 'wp_head', 'feed_links_extra', 3 );
|
65
|
+
// post and comment feeds
|
66
|
+
// remove_action( 'wp_head', 'feed_links', 2 );
|
67
|
+
// EditURI link
|
68
|
+
remove_action( 'wp_head', 'rsd_link' );
|
69
|
+
// windows live writer
|
70
|
+
remove_action( 'wp_head', 'wlwmanifest_link' );
|
71
|
+
// index link
|
72
|
+
remove_action( 'wp_head', 'index_rel_link' );
|
73
|
+
// previous link
|
74
|
+
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
|
75
|
+
// start link
|
76
|
+
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
|
77
|
+
// links for adjacent posts
|
78
|
+
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
|
79
|
+
// WP version
|
80
|
+
remove_action( 'wp_head', 'wp_generator' );
|
81
81
|
// remove WP version from css
|
82
82
|
add_filter( 'style_loader_src', '<%= theme_id %>_remove_wp_ver_css_js', 9999 );
|
83
83
|
// remove Wp version from scripts
|
@@ -106,13 +106,13 @@ function <%= theme_id %>_remove_wp_widget_recent_comments_style() {
|
|
106
106
|
function <%= theme_id %>_remove_recent_comments_style() {
|
107
107
|
global $wp_widget_factory;
|
108
108
|
if (isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) {
|
109
|
-
remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));
|
110
|
-
}
|
109
|
+
remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));
|
110
|
+
}
|
111
111
|
}
|
112
112
|
|
113
113
|
// remove injected CSS from gallery
|
114
114
|
function <%= theme_id %>_gallery_style($css) {
|
115
|
-
return preg_replace("!<style type='text/css'>(.*?)</style>!s", '', $css);
|
115
|
+
return preg_replace("!<style type='text/css'>(.*?)</style>!s", '', $css);
|
116
116
|
}
|
117
117
|
|
118
118
|
|
@@ -122,38 +122,42 @@ SCRIPTS & ENQUEUEING
|
|
122
122
|
|
123
123
|
// loading modernizr and jquery, and reply script
|
124
124
|
function <%= theme_id %>_scripts_and_styles() {
|
125
|
-
global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
|
126
|
-
if (!is_admin()) {
|
125
|
+
global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
|
126
|
+
if (!is_admin()) {
|
127
127
|
|
128
|
-
//
|
129
|
-
|
128
|
+
// modernizr (without media query polyfill)
|
129
|
+
wp_register_script( '<%= theme_id %>-modernizr', get_stylesheet_directory_uri() . '/library/js/libs/modernizr.custom.min.js', array(), '2.5.3', false );
|
130
130
|
|
131
|
-
//
|
132
|
-
wp_register_style( '<%= theme_id %>-
|
131
|
+
// register main stylesheet
|
132
|
+
wp_register_style( '<%= theme_id %>-stylesheet', get_stylesheet_directory_uri() . '/library/css/style.css', array(), '', 'all' );
|
133
133
|
|
134
|
-
//
|
135
|
-
|
136
|
-
wp_enqueue_script( 'comment-reply' );
|
137
|
-
}
|
134
|
+
// ie-only style sheet
|
135
|
+
wp_register_style( '<%= theme_id %>-ie-only', get_stylesheet_directory_uri() . '/library/css/ie.css', array(), '' );
|
138
136
|
|
139
|
-
//
|
140
|
-
|
137
|
+
// comment reply script for threaded comments
|
138
|
+
if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
|
139
|
+
wp_enqueue_script( 'comment-reply' );
|
140
|
+
}
|
141
141
|
|
142
|
-
//
|
143
|
-
|
144
|
-
wp_enqueue_style('<%= theme_id %>-ie-only');
|
142
|
+
//adding scripts file in the footer
|
143
|
+
wp_register_script( '<%= theme_id %>-js', get_stylesheet_directory_uri() . '/library/js/scripts.js', array( 'jquery' ), '', true );
|
145
144
|
|
146
|
-
|
145
|
+
// enqueue styles and scripts
|
146
|
+
wp_enqueue_script( '<%= theme_id %>-modernizr' );
|
147
|
+
wp_enqueue_style( '<%= theme_id %>-stylesheet' );
|
148
|
+
wp_enqueue_style('<%= theme_id %>-ie-only');
|
147
149
|
|
148
|
-
|
149
|
-
I recommend using a plugin to call jQuery
|
150
|
-
using the google cdn. That way it stays cached
|
151
|
-
and your site will load faster.
|
152
|
-
*/
|
153
|
-
wp_enqueue_script( 'jquery' );
|
154
|
-
wp_enqueue_script( '<%= theme_id %>-js' );
|
150
|
+
$wp_styles->add_data( '<%= theme_id %>-ie-only', 'conditional', 'lt IE 9' ); // add conditional wrapper around ie stylesheet
|
155
151
|
|
156
|
-
|
152
|
+
/*
|
153
|
+
I recommend using a plugin to call jQuery
|
154
|
+
using the google cdn. That way it stays cached
|
155
|
+
and your site will load faster.
|
156
|
+
*/
|
157
|
+
wp_enqueue_script( 'jquery' );
|
158
|
+
wp_enqueue_script( '<%= theme_id %>-js' );
|
159
|
+
|
160
|
+
}
|
157
161
|
}
|
158
162
|
|
159
163
|
/*********************
|
@@ -163,53 +167,53 @@ THEME SUPPORT
|
|
163
167
|
// Adding WP 3+ Functions & Theme Support
|
164
168
|
function <%= theme_id %>_theme_support() {
|
165
169
|
|
166
|
-
// wp thumbnails (sizes handled in functions.php)
|
167
|
-
add_theme_support('post-thumbnails');
|
168
|
-
|
169
|
-
// default thumb size
|
170
|
-
set_post_thumbnail_size(125, 125, true);
|
171
|
-
|
172
|
-
// wp custom background (thx to @bransonwerner for update)
|
173
|
-
add_theme_support( 'custom-background',
|
174
|
-
array(
|
175
|
-
'default-image' => '', // background image default
|
176
|
-
'default-color' => '', // background color default (dont add the #)
|
177
|
-
'wp-head-callback' => '_custom_background_cb',
|
178
|
-
'admin-head-callback' => '',
|
179
|
-
'admin-preview-callback' => ''
|
180
|
-
)
|
181
|
-
);
|
182
|
-
|
183
|
-
// rss thingy
|
184
|
-
add_theme_support('automatic-feed-links');
|
185
|
-
|
186
|
-
// to add header image support go here: http://themble.com/support/adding-header-background-image-support/
|
187
|
-
|
188
|
-
// adding post format support
|
189
|
-
add_theme_support( 'post-formats',
|
190
|
-
array(
|
191
|
-
'aside', // title less blurb
|
192
|
-
'gallery', // gallery of images
|
193
|
-
'link', // quick link to other site
|
194
|
-
'image', // an image
|
195
|
-
'quote', // a quick quote
|
196
|
-
'status', // a Facebook like status update
|
197
|
-
'video', // video
|
198
|
-
'audio', // audio
|
199
|
-
'chat' // chat transcript
|
200
|
-
)
|
201
|
-
);
|
202
|
-
|
203
|
-
// wp menus
|
204
|
-
add_theme_support( 'menus' );
|
205
|
-
|
206
|
-
// registering wp3+ menus
|
207
|
-
register_nav_menus(
|
208
|
-
array(
|
209
|
-
'main-nav' => __( 'The Main Menu', '<%= theme_id %>theme' ), // main nav in header
|
210
|
-
'footer-links' => __( 'Footer Links', '<%= theme_id %>theme' ) // secondary nav in footer
|
211
|
-
)
|
212
|
-
);
|
170
|
+
// wp thumbnails (sizes handled in functions.php)
|
171
|
+
add_theme_support('post-thumbnails');
|
172
|
+
|
173
|
+
// default thumb size
|
174
|
+
set_post_thumbnail_size(125, 125, true);
|
175
|
+
|
176
|
+
// wp custom background (thx to @bransonwerner for update)
|
177
|
+
add_theme_support( 'custom-background',
|
178
|
+
array(
|
179
|
+
'default-image' => '', // background image default
|
180
|
+
'default-color' => '', // background color default (dont add the #)
|
181
|
+
'wp-head-callback' => '_custom_background_cb',
|
182
|
+
'admin-head-callback' => '',
|
183
|
+
'admin-preview-callback' => ''
|
184
|
+
)
|
185
|
+
);
|
186
|
+
|
187
|
+
// rss thingy
|
188
|
+
add_theme_support('automatic-feed-links');
|
189
|
+
|
190
|
+
// to add header image support go here: http://themble.com/support/adding-header-background-image-support/
|
191
|
+
|
192
|
+
// adding post format support
|
193
|
+
add_theme_support( 'post-formats',
|
194
|
+
array(
|
195
|
+
'aside', // title less blurb
|
196
|
+
'gallery', // gallery of images
|
197
|
+
'link', // quick link to other site
|
198
|
+
'image', // an image
|
199
|
+
'quote', // a quick quote
|
200
|
+
'status', // a Facebook like status update
|
201
|
+
'video', // video
|
202
|
+
'audio', // audio
|
203
|
+
'chat' // chat transcript
|
204
|
+
)
|
205
|
+
);
|
206
|
+
|
207
|
+
// wp menus
|
208
|
+
add_theme_support( 'menus' );
|
209
|
+
|
210
|
+
// registering wp3+ menus
|
211
|
+
register_nav_menus(
|
212
|
+
array(
|
213
|
+
'main-nav' => __( 'The Main Menu', '<%= theme_id %>theme' ), // main nav in header
|
214
|
+
'footer-links' => __( 'Footer Links', '<%= theme_id %>theme' ) // secondary nav in footer
|
215
|
+
)
|
216
|
+
);
|
213
217
|
} /* end <%= theme_id %> theme support */
|
214
218
|
|
215
219
|
|
@@ -219,56 +223,56 @@ MENUS & NAVIGATION
|
|
219
223
|
|
220
224
|
// the main menu
|
221
225
|
function <%= theme_id %>_main_nav() {
|
222
|
-
// display the wp3 menu if available
|
223
|
-
wp_nav_menu(array(
|
224
|
-
'container' => false, // remove nav container
|
225
|
-
'container_class' => 'menu clearfix', // class of container (should you choose to use it)
|
226
|
-
'menu' => __( 'The Main Menu', '<%= theme_id %>theme' ), // nav name
|
227
|
-
'menu_class' => 'nav top-nav clearfix', // adding custom nav class
|
228
|
-
'theme_location' => 'main-nav', // where it's located in the theme
|
229
|
-
'before' => '', // before the menu
|
230
|
-
'after' => '', // after the menu
|
231
|
-
'link_before' => '', // before each link
|
232
|
-
'link_after' => '', // after each link
|
233
|
-
'depth' => 0, // limit the depth of the nav
|
234
|
-
'fallback_cb' => '<%= theme_id %>_main_nav_fallback' // fallback function
|
235
|
-
));
|
226
|
+
// display the wp3 menu if available
|
227
|
+
wp_nav_menu(array(
|
228
|
+
'container' => false, // remove nav container
|
229
|
+
'container_class' => 'menu clearfix', // class of container (should you choose to use it)
|
230
|
+
'menu' => __( 'The Main Menu', '<%= theme_id %>theme' ), // nav name
|
231
|
+
'menu_class' => 'nav top-nav clearfix', // adding custom nav class
|
232
|
+
'theme_location' => 'main-nav', // where it's located in the theme
|
233
|
+
'before' => '', // before the menu
|
234
|
+
'after' => '', // after the menu
|
235
|
+
'link_before' => '', // before each link
|
236
|
+
'link_after' => '', // after each link
|
237
|
+
'depth' => 0, // limit the depth of the nav
|
238
|
+
'fallback_cb' => '<%= theme_id %>_main_nav_fallback' // fallback function
|
239
|
+
));
|
236
240
|
} /* end <%= theme_id %> main nav */
|
237
241
|
|
238
242
|
// the footer menu (should you choose to use one)
|
239
243
|
function <%= theme_id %>_footer_links() {
|
240
|
-
// display the wp3 menu if available
|
241
|
-
wp_nav_menu(array(
|
242
|
-
'container' => '', // remove nav container
|
243
|
-
'container_class' => 'footer-links clearfix', // class of container (should you choose to use it)
|
244
|
-
'menu' => __( 'Footer Links', '<%= theme_id %>theme' ), // nav name
|
245
|
-
'menu_class' => 'nav footer-nav clearfix', // adding custom nav class
|
246
|
-
'theme_location' => 'footer-links', // where it's located in the theme
|
247
|
-
'before' => '', // before the menu
|
248
|
-
'after' => '', // after the menu
|
249
|
-
'link_before' => '', // before each link
|
250
|
-
'link_after' => '', // after each link
|
251
|
-
'depth' => 0, // limit the depth of the nav
|
252
|
-
'fallback_cb' => '<%= theme_id %>_footer_links_fallback' // fallback function
|
253
|
-
));
|
244
|
+
// display the wp3 menu if available
|
245
|
+
wp_nav_menu(array(
|
246
|
+
'container' => '', // remove nav container
|
247
|
+
'container_class' => 'footer-links clearfix', // class of container (should you choose to use it)
|
248
|
+
'menu' => __( 'Footer Links', '<%= theme_id %>theme' ), // nav name
|
249
|
+
'menu_class' => 'nav footer-nav clearfix', // adding custom nav class
|
250
|
+
'theme_location' => 'footer-links', // where it's located in the theme
|
251
|
+
'before' => '', // before the menu
|
252
|
+
'after' => '', // after the menu
|
253
|
+
'link_before' => '', // before each link
|
254
|
+
'link_after' => '', // after each link
|
255
|
+
'depth' => 0, // limit the depth of the nav
|
256
|
+
'fallback_cb' => '<%= theme_id %>_footer_links_fallback' // fallback function
|
257
|
+
));
|
254
258
|
} /* end <%= theme_id %> footer link */
|
255
259
|
|
256
260
|
// this is the fallback for header menu
|
257
261
|
function <%= theme_id %>_main_nav_fallback() {
|
258
|
-
wp_page_menu( array(
|
259
|
-
'show_home' => true,
|
260
|
-
'menu_class' => 'nav top-nav clearfix', // adding custom nav class
|
261
|
-
'include' => '',
|
262
|
-
'exclude' => '',
|
263
|
-
'echo' => true,
|
264
|
-
'link_before' => '', // before each link
|
265
|
-
'link_after' => '' // after each link
|
266
|
-
) );
|
262
|
+
wp_page_menu( array(
|
263
|
+
'show_home' => true,
|
264
|
+
'menu_class' => 'nav top-nav clearfix', // adding custom nav class
|
265
|
+
'include' => '',
|
266
|
+
'exclude' => '',
|
267
|
+
'echo' => true,
|
268
|
+
'link_before' => '', // before each link
|
269
|
+
'link_after' => '' // after each link
|
270
|
+
) );
|
267
271
|
}
|
268
272
|
|
269
273
|
// this is the fallback for footer menu
|
270
274
|
function <%= theme_id %>_footer_links_fallback() {
|
271
|
-
/* you can put a default here if you like */
|
275
|
+
/* you can put a default here if you like */
|
272
276
|
}
|
273
277
|
|
274
278
|
/*********************
|
@@ -277,35 +281,35 @@ RELATED POSTS FUNCTION
|
|
277
281
|
|
278
282
|
// Related Posts Function (call using <%= theme_id %>_related_posts(); )
|
279
283
|
function <%= theme_id %>_related_posts() {
|
280
|
-
echo '<ul id="<%= theme_id %>-related-posts">';
|
284
|
+
echo '<ul id="<%= theme_id %>-related-posts">';
|
281
285
|
global $post;
|
282
286
|
$tags = wp_get_post_tags($post->ID);
|
283
287
|
if($tags) {
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
288
|
+
foreach($tags as $tag) { $tag_arr .= $tag->slug . ','; }
|
289
|
+
$args = array(
|
290
|
+
'tag' => $tag_arr,
|
291
|
+
'numberposts' => 5, /* you can change this to show more */
|
292
|
+
'post__not_in' => array($post->ID)
|
293
|
+
);
|
294
|
+
$related_posts = get_posts($args);
|
295
|
+
if($related_posts) {
|
296
|
+
foreach ($related_posts as $post) : setup_postdata($post); ?>
|
297
|
+
<li class="related_post"><a class="entry-unrelated" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
|
298
|
+
<?php endforeach; }
|
299
|
+
else { ?>
|
300
|
+
<?php echo '<li class="no_related_post">' . __( 'No Related Posts Yet!', '<%= theme_id %>theme' ) . '</li>'; ?>
|
301
|
+
<?php }
|
302
|
+
}
|
303
|
+
wp_reset_query();
|
304
|
+
echo '</ul>';
|
305
|
+
} /* end <%= theme_id %> related posts function */
|
306
|
+
|
307
|
+
/*********************
|
308
|
+
PAGE NAVI
|
309
|
+
*********************/
|
310
|
+
|
311
|
+
// Numeric Page Navi (built into the theme by default)
|
312
|
+
function <%= theme_id %>_page_navi($before = '', $after = '') {
|
309
313
|
global $wpdb, $wp_query;
|
310
314
|
$request = $wp_query->request;
|
311
315
|
$posts_per_page = intval(get_query_var('posts_per_page'));
|
@@ -314,7 +318,7 @@ echo '<ul id="<%= theme_id %>-related-posts">';
|
|
314
318
|
$max_page = $wp_query->max_num_pages;
|
315
319
|
if ( $numposts <= $posts_per_page ) { return; }
|
316
320
|
if(empty($paged) || $paged == 0) {
|
317
|
-
|
321
|
+
$paged = 1;
|
318
322
|
}
|
319
323
|
$pages_to_show = 7;
|
320
324
|
$pages_to_show_minus_1 = $pages_to_show-1;
|
@@ -322,76 +326,76 @@ echo '<ul id="<%= theme_id %>-related-posts">';
|
|
322
326
|
$half_page_end = ceil($pages_to_show_minus_1/2);
|
323
327
|
$start_page = $paged - $half_page_start;
|
324
328
|
if($start_page <= 0) {
|
325
|
-
|
329
|
+
$start_page = 1;
|
326
330
|
}
|
327
331
|
$end_page = $paged + $half_page_end;
|
328
332
|
if(($end_page - $start_page) != $pages_to_show_minus_1) {
|
329
|
-
|
333
|
+
$end_page = $start_page + $pages_to_show_minus_1;
|
330
334
|
}
|
331
335
|
if($end_page > $max_page) {
|
332
|
-
|
333
|
-
|
336
|
+
$start_page = $max_page - $pages_to_show_minus_1;
|
337
|
+
$end_page = $max_page;
|
334
338
|
}
|
335
339
|
if($start_page <= 0) {
|
336
|
-
|
340
|
+
$start_page = 1;
|
337
341
|
}
|
338
342
|
echo $before.'<nav class="page-navigation"><ol class="<%= theme_id %>_page_navi clearfix">'."";
|
339
343
|
if ($start_page >= 2 && $pages_to_show < $max_page) {
|
340
|
-
|
341
|
-
|
344
|
+
$first_page_text = __( "First", '<%= theme_id %>theme' );
|
345
|
+
echo '<li class="bpn-first-page-link"><a href="'.get_pagenum_link().'" title="'.$first_page_text.'">'.$first_page_text.'</a></li>';
|
342
346
|
}
|
343
347
|
echo '<li class="bpn-prev-link">';
|
344
348
|
previous_posts_link('<<');
|
345
349
|
echo '</li>';
|
346
350
|
for($i = $start_page; $i <= $end_page; $i++) {
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
351
|
+
if($i == $paged) {
|
352
|
+
echo '<li class="bpn-current">'.$i.'</li>';
|
353
|
+
} else {
|
354
|
+
echo '<li><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>';
|
355
|
+
}
|
352
356
|
}
|
353
357
|
echo '<li class="bpn-next-link">';
|
354
358
|
next_posts_link('>>');
|
355
359
|
echo '</li>';
|
356
360
|
if ($end_page < $max_page) {
|
357
|
-
|
358
|
-
|
361
|
+
$last_page_text = __( "Last", '<%= theme_id %>theme' );
|
362
|
+
echo '<li class="bpn-last-page-link"><a href="'.get_pagenum_link($max_page).'" title="'.$last_page_text.'">'.$last_page_text.'</a></li>';
|
359
363
|
}
|
360
364
|
echo '</ol></nav>'.$after."";
|
361
|
-
|
365
|
+
} /* end page navi */
|
362
366
|
|
363
|
-
|
364
|
-
|
365
|
-
|
367
|
+
/*********************
|
368
|
+
RANDOM CLEANUP ITEMS
|
369
|
+
*********************/
|
366
370
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
+
// remove the p from around imgs (http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/)
|
372
|
+
function <%= theme_id %>_filter_ptags_on_images($content){
|
373
|
+
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
|
374
|
+
}
|
371
375
|
|
372
|
-
|
373
|
-
|
376
|
+
// This removes the annoying […] to a Read More link
|
377
|
+
function <%= theme_id %>_excerpt_more($more) {
|
374
378
|
global $post;
|
375
379
|
// edit here if you like
|
376
|
-
|
377
|
-
|
380
|
+
return '... <a class="excerpt-read-more" href="'. get_permalink($post->ID) . '" title="'. __('Read', '<%= theme_id %>theme') . get_the_title($post->ID).'">'. __('Read more »', '<%= theme_id %>theme') .'</a>';
|
381
|
+
}
|
378
382
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
383
|
+
/*
|
384
|
+
* This is a modified the_author_posts_link() which just returns the link.
|
385
|
+
*
|
386
|
+
* This is necessary to allow usage of the usual l10n process with printf().
|
387
|
+
*/
|
388
|
+
function <%= theme_id %>_get_the_author_posts_link() {
|
385
389
|
global $authordata;
|
386
390
|
if ( !is_object( $authordata ) )
|
387
|
-
|
391
|
+
return false;
|
388
392
|
$link = sprintf(
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
+
'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
|
394
|
+
get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
|
395
|
+
esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), // No further l10n needed, core will take care of this one
|
396
|
+
get_the_author()
|
393
397
|
);
|
394
398
|
return $link;
|
395
|
-
|
399
|
+
}
|
396
400
|
|
397
|
-
|
401
|
+
?>
|