-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
262 lines (199 loc) · 8.38 KB
/
functions.php
File metadata and controls
262 lines (199 loc) · 8.38 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<?php
/*
Author: DD9, Eddie Machado, and Others
This is where you can drop your custom functions or
just edit things like thumbnail sizes, header images,
sidebars, comments, ect.
*/
/************* INCLUDE NEEDED FILES ***************/
require_once( 'library/navwalker.php' ); // needed for bootstrap navigation
require_once( 'library/utilities.php' ); // misc generic helpers
require_once( 'library/shortcodes.php' ); // shortcodes
/************* SETUP DEFAULT PAGES ON ACTIVATION ***************/
// Disable this section until we move it into a dedicated function
/*
require_once( 'library/site_init.php' );
$pages = array(
array('page_title' => 'Assets'),
array('page_title' => 'Home'),
array('page_title' => 'About'),
array('page_title' => 'News'),
array('page_title' => 'Contact'),
);
add_pages($pages);
*/
/************* INSERT THEME FUNCTIONS HERE ********************/
/************* BREW & BOILER FILES ********************/
$protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
define('PROTOCOL', $protocol); // are we in http / https
define('TMPL_URL', rtrim( get_template_directory_uri() , '/' )); // full URL, NO trailing slash
define('TMPL_DIR', rtrim( get_template_directory() , '/' ) ); // full directory all the way to root, NO trailing slash
function boiler_dependencies() {
if( ! function_exists('acf_add_options_page') )
echo '<div class="error"><p> Warning: The theme needs ACF Plugin installed and activated to function </p></div>';
}
add_action( 'admin_notices', 'boiler_dependencies' );
//http://www.advancedcustomfields.com/resources/features/options-page/
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
/* library/bones.php (functions specific to BREW)
- navwalker
- Read more > Bootstrap button
- Bootstrap style pagination
- Bootstrap style breadcrumbs
*/
require_once( 'library/brew.php' ); // if you remove this, BREW will break
/*
1. library/bones.php
- head cleanup (remove rsd, uri links, junk css, ect)
- enqueueing scripts & styles
- theme support functions
- custom menu output & fallbacks
- related post function
- page-navi function
- removing <p> from around images
- customizing the post excerpt
- custom google+ integration
- adding custom fields to user profiles
*/
require_once( 'library/bones.php' ); // if you remove this, bones will break
//Optional for Boiler
require_once( 'library/admin.php' ); // dashboard customizations
/************* CUSTOM POST TYPES *************/
/*
Hardcode custom post types here if you want to keep them out of the dashboard
This is a good idea in many cases. Otherwise use: https://wordpress.org/plugins/custom-post-type-ui/
*/
//WP Custom Post Type Class
//https://github.com/jjgrainger/wp-custom-post-type-class
//require_once( 'library/CPT.php' );
// Flush rewrite rules for custom post types
// function boiler_flush_rewrite_rules() {
// flush_rewrite_rules();
// }
// add_action( 'after_switch_theme', 'boiler_flush_rewrite_rules' );
/************* THUMBNAIL SIZE OPTIONS *************/
// Thumbnail sizes
//add_image_size( 'bones-thumb-600', 600, 150, true );
//add_image_size( 'bones-thumb-300', 300, 100, true );
//add_image_size( 'post-featured', 750, 300, true );
/*
to add more sizes, simply copy a line from above
and change the dimensions & name. As long as you
upload a "featured image" as large as the biggest
set width or height, all the other sizes will be
auto-cropped.
To call a different size, simply change the text
inside the thumbnail function.
For example, to call the 300 x 300 sized image,
we would use the function:
<?php the_post_thumbnail( 'bones-thumb-300' ); ?>
for the 600 x 100 image:
<?php the_post_thumbnail( 'bones-thumb-600' ); ?>
You can change the names and dimensions to whatever
you like. Enjoy!
*/
/************* ACTIVE SIDEBARS ********************/
// Sidebars & Widgetizes Areas
function bones_register_sidebars() {
register_sidebar(array(
'id' => 'sidebar_blog',
'name' => __( 'Blog Sidebar', 'bonestheme' ),
'description' => __( 'Blog Sidebar - does not appear on mobile devices', 'bonestheme' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'sidebar_blog_mobile',
'name' => __( 'Blog Sidebar(mobile)', 'bonestheme' ),
'description' => __( 'Blog Sidebar - only appears on mobile devices', 'bonestheme' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
// add footer widgets
register_sidebar(array(
'id' => 'footer-1',
'name' => __( 'Footer Widget 1', 'bonestheme' ),
'description' => __( 'The first footer widget.', 'bonestheme' ),
'before_widget' => '<div id="%1$s" class="widget widgetFooter %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-2',
'name' => __( 'Footer Widget 2', 'bonestheme' ),
'description' => __( 'The second footer widget.', 'bonestheme' ),
'before_widget' => '<div id="%1$s" class="widget widgetFooter %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-3',
'name' => __( 'Footer Widget 3', 'bonestheme' ),
'description' => __( 'The third footer widget.', 'bonestheme' ),
'before_widget' => '<div id="%1$s" class="widget widgetFooter %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-4',
'name' => __( 'Footer Widget 4', 'bonestheme' ),
'description' => __( 'The fourth footer widget.', 'bonestheme' ),
'before_widget' => '<div id="%1$s" class="widget widgetFooter %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
/*
to add more sidebars or widgetized areas, just copy
and edit the above sidebar code. In order to call
your new sidebar just use the following code:
*/
} // don't remove this bracket!
/************* COMMENT LAYOUT *********************/
// Comment Layout
function bones_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?>>
<article id="comment-<?php comment_ID(); ?>" class="clearfix comment-container">
<div class="comment-author vcard">
<?php
/*
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:
echo get_avatar($comment,$size='32',$default='<path_to_url>' );
*/
?>
<?php // custom gravatar call ?>
<?php
// create variable
$bgauthemail = get_comment_author_email();
?>
<img data-gravatar="http://www.gravatar.com/avatar/<?php echo md5( $bgauthemail ); ?>?s=64" class="load-gravatar avatar avatar-48 photo" height="64" width="64" src="<?php echo get_template_directory_uri(); ?>/images/favicon.png" />
<?php // end custom gravatar call ?>
</div>
<div class="comment-content">
<?php printf(__( '<cite class="fn">%s |</cite>', 'bonestheme' ), get_comment_author_link()) ?>
<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', 'bonestheme' )); ?> </a></time>
<?php edit_comment_link(__( '(Edit)', 'bonestheme' ),' ','') ?>
<?php if ($comment->comment_approved == '0') : ?>
<div class="alert alert-info">
<p><?php _e( 'Your comment is awaiting moderation.', 'bonestheme' ) ?></p>
</div>
<?php endif; ?>
<section class="comment_content clearfix">
<?php comment_text() ?>
</section>
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div> <!-- END comment-content -->
</article>
<?php // </li> is added by WordPress automatically ?>
<?php
} // don't remove this bracket!