2121
2222function bones_ahoy () {
2323
24- // launching operation cleanup
25- add_action ( 'init ' , 'bones_head_cleanup ' );
26- // remove WP version from RSS
27- add_filter ( 'the_generator ' , 'bones_rss_version ' );
28- // remove pesky injected css for recent comments widget
29- add_filter ( 'wp_head ' , 'bones_remove_wp_widget_recent_comments_style ' , 1 );
30- // clean up comment styles in the head
31- add_action ( 'wp_head ' , 'bones_remove_recent_comments_style ' , 1 );
32- // clean up gallery output in wp
33- add_filter ( 'gallery_style ' , 'bones_gallery_style ' );
34-
35- // enqueue base scripts and styles
36- add_action ( 'wp_enqueue_scripts ' , 'bones_scripts_and_styles ' , 999 );
37- // ie conditional wrapper
38-
39- // launching this stuff after theme setup
40- bones_theme_support ();
41-
42- // adding sidebars to Wordpress (these are created in functions.php)
43- add_action ( 'widgets_init ' , 'bones_register_sidebars ' );
44- // adding the bones search form (created in functions.php)
45- add_filter ( 'get_search_form ' , 'bones_wpsearch ' );
46-
47- // cleaning up random code around images
48- add_filter ( 'the_content ' , 'bones_filter_ptags_on_images ' );
49- // cleaning up excerpt
50- add_filter ( 'excerpt_more ' , 'bones_excerpt_more ' );
24+ // launching operation cleanup
25+ add_action ( 'init ' , 'bones_head_cleanup ' );
26+ // remove WP version from RSS
27+ add_filter ( 'the_generator ' , 'bones_rss_version ' );
28+ // remove pesky injected css for recent comments widget
29+ add_filter ( 'wp_head ' , 'bones_remove_wp_widget_recent_comments_style ' , 1 );
30+ // clean up comment styles in the head
31+ add_action ( 'wp_head ' , 'bones_remove_recent_comments_style ' , 1 );
32+ // clean up gallery output in wp
33+ add_filter ( 'gallery_style ' , 'bones_gallery_style ' );
34+
35+ // enqueue base scripts and styles
36+ add_action ( 'wp_enqueue_scripts ' , 'bones_scripts_and_styles ' , 999 );
37+ // ie conditional wrapper
38+
39+ // launching this stuff after theme setup
40+ bones_theme_support ();
41+
42+ // adding sidebars to Wordpress (these are created in functions.php)
43+ add_action ( 'widgets_init ' , 'bones_register_sidebars ' );
44+ // adding the bones search form (created in functions.php)
45+ add_filter ( 'get_search_form ' , 'bones_wpsearch ' );
46+
47+ // cleaning up random code around images
48+ add_filter ( 'the_content ' , 'bones_filter_ptags_on_images ' );
49+ // cleaning up excerpt
50+ add_filter ( 'excerpt_more ' , 'bones_excerpt_more ' );
5151
5252} /* end bones ahoy */
5353
@@ -90,29 +90,29 @@ function bones_rss_version() { return ''; }
9090
9191// remove WP version from scripts
9292function bones_remove_wp_ver_css_js ( $ src ) {
93- if ( strpos ( $ src , 'ver= ' ) )
94- $ src = remove_query_arg ( 'ver ' , $ src );
95- return $ src ;
93+ if ( strpos ( $ src , 'ver= ' ) )
94+ $ src = remove_query_arg ( 'ver ' , $ src );
95+ return $ src ;
9696}
9797
9898// remove injected CSS for recent comments widget
9999function bones_remove_wp_widget_recent_comments_style () {
100- if ( has_filter ( 'wp_head ' , 'wp_widget_recent_comments_style ' ) ) {
101- remove_filter ( 'wp_head ' , 'wp_widget_recent_comments_style ' );
102- }
100+ if ( has_filter ( 'wp_head ' , 'wp_widget_recent_comments_style ' ) ) {
101+ remove_filter ( 'wp_head ' , 'wp_widget_recent_comments_style ' );
102+ }
103103}
104104
105105// remove injected CSS from recent comments widget
106106function bones_remove_recent_comments_style () {
107- global $ wp_widget_factory ;
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- }
107+ global $ wp_widget_factory ;
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+ }
111111}
112112
113113// remove injected CSS from gallery
114114function bones_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 );
116116}
117117
118118
@@ -122,42 +122,42 @@ function bones_gallery_style($css) {
122122
123123// loading modernizr and jquery, and reply script
124124function bones_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 ()) {
127127
128- // modernizr (without media query polyfill)
129- wp_register_script ( 'bones-modernizr ' , get_stylesheet_directory_uri () . '/library/js/libs/modernizr.custom.min.js ' , array (), '2.5.3 ' , false );
128+ // modernizr (without media query polyfill)
129+ wp_register_script ( 'bones-modernizr ' , get_stylesheet_directory_uri () . '/library/js/libs/modernizr.custom.min.js ' , array (), '2.5.3 ' , false );
130130
131- // register main stylesheet
132- wp_register_style ( 'bones-stylesheet ' , get_stylesheet_directory_uri () . '/library/css/style.css ' , array (), '' , 'all ' );
131+ // register main stylesheet
132+ wp_register_style ( 'bones-stylesheet ' , get_stylesheet_directory_uri () . '/library/css/style.css ' , array (), '' , 'all ' );
133133
134- // ie-only style sheet
135- wp_register_style ( 'bones-ie-only ' , get_stylesheet_directory_uri () . '/library/css/ie.css ' , array (), '' );
134+ // ie-only style sheet
135+ wp_register_style ( 'bones-ie-only ' , get_stylesheet_directory_uri () . '/library/css/ie.css ' , array (), '' );
136136
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- }
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+ }
141141
142- //adding scripts file in the footer
143- wp_register_script ( 'bones-js ' , get_stylesheet_directory_uri () . '/library/js/scripts.js ' , array ( 'jquery ' ), '' , true );
142+ //adding scripts file in the footer
143+ wp_register_script ( 'bones-js ' , get_stylesheet_directory_uri () . '/library/js/scripts.js ' , array ( 'jquery ' ), '' , true );
144144
145- // enqueue styles and scripts
146- wp_enqueue_script ( 'bones-modernizr ' );
147- wp_enqueue_style ( 'bones-stylesheet ' );
148- wp_enqueue_style ( 'bones-ie-only ' );
145+ // enqueue styles and scripts
146+ wp_enqueue_script ( 'bones-modernizr ' );
147+ wp_enqueue_style ( 'bones-stylesheet ' );
148+ wp_enqueue_style ( 'bones-ie-only ' );
149149
150- $ wp_styles ->add_data ( 'bones-ie-only ' , 'conditional ' , 'lt IE 9 ' ); // add conditional wrapper around ie stylesheet
150+ $ wp_styles ->add_data ( 'bones-ie-only ' , 'conditional ' , 'lt IE 9 ' ); // add conditional wrapper around ie stylesheet
151151
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 ( 'bones-js ' );
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 ( 'bones-js ' );
159159
160- }
160+ }
161161}
162162
163163/*********************
@@ -175,13 +175,13 @@ function bones_theme_support() {
175175
176176 // wp custom background (thx to @bransonwerner for update)
177177 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- )
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+ )
185185 );
186186
187187 // rss thingy
@@ -224,49 +224,49 @@ function bones_theme_support() {
224224// the main menu
225225function bones_main_nav () {
226226 // 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 ' , 'bonestheme ' ), // 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 ' => 'bones_main_nav_fallback ' // fallback function
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 ' , 'bonestheme ' ), // 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 ' => 'bones_main_nav_fallback ' // fallback function
239239 ));
240240} /* end bones main nav */
241241
242242// the footer menu (should you choose to use one)
243243function bones_footer_links () {
244244 // 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 ' , 'bonestheme ' ), // 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 ' => 'bones_footer_links_fallback ' // fallback function
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 ' , 'bonestheme ' ), // 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 ' => 'bones_footer_links_fallback ' // fallback function
257257 ));
258258} /* end bones footer link */
259259
260260// this is the fallback for header menu
261261function bones_main_nav_fallback () {
262262 wp_page_menu ( array (
263263 'show_home ' => true ,
264- 'menu_class ' => 'nav top-nav clearfix ' , // adding custom nav class
264+ 'menu_class ' => 'nav top-nav clearfix ' , // adding custom nav class
265265 'include ' => '' ,
266266 'exclude ' => '' ,
267267 'echo ' => true ,
268- 'link_before ' => '' , // before each link
269- 'link_after ' => '' // after each link
268+ 'link_before ' => '' , // before each link
269+ 'link_after ' => '' // after each link
270270 ) );
271271}
272272
@@ -288,18 +288,18 @@ function bones_related_posts() {
288288 foreach ( $ tags as $ tag ) {
289289 $ tag_arr .= $ tag ->slug . ', ' ;
290290 }
291- $ args = array (
292- 'tag ' => $ tag_arr ,
293- 'numberposts ' => 5 , /* you can change this to show more */
294- 'post__not_in ' => array ($ post ->ID )
295- );
296- $ related_posts = get_posts ( $ args );
297- if ($ related_posts ) {
298- foreach ( $ related_posts as $ post ) : setup_postdata ( $ post ); ?>
299- <li class="related_post"><a class="entry-unrelated" href="<?php the_permalink () ?> " title="<?php the_title_attribute (); ?> "><?php the_title (); ?> </a></li>
300- <?php endforeach ; }
301- else { ?>
302- <?php echo '<li class="no_related_post"> ' . __ ( 'No Related Posts Yet! ' , 'bonestheme ' ) . '</li> ' ; ?>
291+ $ args = array (
292+ 'tag ' => $ tag_arr ,
293+ 'numberposts ' => 5 , /* you can change this to show more */
294+ 'post__not_in ' => array ($ post ->ID )
295+ );
296+ $ related_posts = get_posts ( $ args );
297+ if ($ related_posts ) {
298+ foreach ( $ related_posts as $ post ) : setup_postdata ( $ post ); ?>
299+ <li class="related_post"><a class="entry-unrelated" href="<?php the_permalink () ?> " title="<?php the_title_attribute (); ?> "><?php the_title (); ?> </a></li>
300+ <?php endforeach ; }
301+ else { ?>
302+ <?php echo '<li class="no_related_post"> ' . __ ( 'No Related Posts Yet! ' , 'bonestheme ' ) . '</li> ' ; ?>
303303 <?php }
304304 }
305305 wp_reset_query ();
@@ -315,7 +315,7 @@ function bones_page_navi() {
315315 global $ wp_query ;
316316 $ bignum = 999999999 ;
317317 if ( $ wp_query ->max_num_pages <= 1 )
318- return ;
318+ return ;
319319
320320 echo '<nav class="pagination"> ' ;
321321
@@ -340,14 +340,14 @@ function bones_page_navi() {
340340
341341// remove the p from around imgs (http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/)
342342function bones_filter_ptags_on_images ($ content ){
343- return preg_replace ('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU ' , '\1\2\3 ' , $ content );
343+ return preg_replace ('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU ' , '\1\2\3 ' , $ content );
344344}
345345
346346// This removes the annoying […] to a Read More link
347347function bones_excerpt_more ($ more ) {
348348 global $ post ;
349349 // edit here if you like
350- return '... <a class="excerpt-read-more" href=" ' . get_permalink ($ post ->ID ) . '" title=" ' . __ ( 'Read ' , 'bonestheme ' ) . get_the_title ($ post ->ID ).'"> ' . __ ( 'Read more » ' , 'bonestheme ' ) .'</a> ' ;
350+ return '... <a class="excerpt-read-more" href=" ' . get_permalink ($ post ->ID ) . '" title=" ' . __ ( 'Read ' , 'bonestheme ' ) . get_the_title ($ post ->ID ).'"> ' . __ ( 'Read more » ' , 'bonestheme ' ) .'</a> ' ;
351351}
352352
353353/*
0 commit comments