|
|
@@ -7,49 +7,22 @@ in the functions.php file.
|
|
|
|
|
|
Developed by: Eddie Machado
|
|
|
URL: http://themble.com/bones/
|
|
|
-*/
|
|
|
-
|
|
|
-/*********************
|
|
|
-LAUNCH BONES
|
|
|
-Let's fire off all the functions
|
|
|
-and tools. I put it up here so it's
|
|
|
-right up top and clean.
|
|
|
-*********************/
|
|
|
-
|
|
|
-// we're firing all out initial functions at the start
|
|
|
-add_action( 'after_setup_theme', 'bones_ahoy', 16 );
|
|
|
|
|
|
-function bones_ahoy() {
|
|
|
|
|
|
- // launching operation cleanup
|
|
|
- add_action( 'init', 'bones_head_cleanup' );
|
|
|
- // remove WP version from RSS
|
|
|
- add_filter( 'the_generator', 'bones_rss_version' );
|
|
|
- // remove pesky injected css for recent comments widget
|
|
|
- add_filter( 'wp_head', 'bones_remove_wp_widget_recent_comments_style', 1 );
|
|
|
- // clean up comment styles in the head
|
|
|
- add_action( 'wp_head', 'bones_remove_recent_comments_style', 1 );
|
|
|
- // clean up gallery output in wp
|
|
|
- add_filter( 'gallery_style', 'bones_gallery_style' );
|
|
|
|
|
|
- // enqueue base scripts and styles
|
|
|
- add_action( 'wp_enqueue_scripts', 'bones_scripts_and_styles', 999 );
|
|
|
- // ie conditional wrapper
|
|
|
|
|
|
- // launching this stuff after theme setup
|
|
|
- bones_theme_support();
|
|
|
+ - 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
|
|
|
|
|
|
- // adding sidebars to Wordpress (these are created in functions.php)
|
|
|
- add_action( 'widgets_init', 'bones_register_sidebars' );
|
|
|
- // adding the bones search form (created in functions.php)
|
|
|
- add_filter( 'get_search_form', 'bones_wpsearch' );
|
|
|
-
|
|
|
- // cleaning up random code around images
|
|
|
- add_filter( 'the_content', 'bones_filter_ptags_on_images' );
|
|
|
- // cleaning up excerpt
|
|
|
- add_filter( 'excerpt_more', 'bones_excerpt_more' );
|
|
|
-
|
|
|
-} /* end bones ahoy */
|
|
|
+*/
|
|
|
|
|
|
/*********************
|
|
|
WP_HEAD GOODNESS
|
|
|
@@ -123,6 +96,7 @@ SCRIPTS & ENQUEUEING
|
|
|
// loading modernizr and jquery, and reply script
|
|
|
function bones_scripts_and_styles() {
|
|
|
global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
|
|
|
+
|
|
|
if (!is_admin()) {
|
|
|
|
|
|
// modernizr (without media query polyfill)
|
|
|
@@ -136,7 +110,7 @@ function bones_scripts_and_styles() {
|
|
|
|
|
|
// comment reply script for threaded comments
|
|
|
if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
|
|
|
- wp_enqueue_script( 'comment-reply' );
|
|
|
+ wp_enqueue_script( 'comment-reply' );
|
|
|
}
|
|
|
|
|
|
//adding scripts file in the footer
|
|
|
@@ -176,8 +150,8 @@ function bones_theme_support() {
|
|
|
// wp custom background (thx to @bransonwerner for update)
|
|
|
add_theme_support( 'custom-background',
|
|
|
array(
|
|
|
- 'default-image' => '', // background image default
|
|
|
- 'default-color' => '', // background color default (dont add the #)
|
|
|
+ 'default-image' => '', // background image default
|
|
|
+ 'default-color' => '', // background color default (dont add the #)
|
|
|
'wp-head-callback' => '_custom_background_cb',
|
|
|
'admin-head-callback' => '',
|
|
|
'admin-preview-callback' => ''
|
|
|
@@ -216,65 +190,6 @@ function bones_theme_support() {
|
|
|
);
|
|
|
} /* end bones theme support */
|
|
|
|
|
|
-
|
|
|
-/*********************
|
|
|
-MENUS & NAVIGATION
|
|
|
-*********************/
|
|
|
-
|
|
|
-// the main menu
|
|
|
-function bones_main_nav() {
|
|
|
- // display the wp3 menu if available
|
|
|
- wp_nav_menu(array(
|
|
|
- 'container' => false, // remove nav container
|
|
|
- 'container_class' => 'menu clearfix', // class of container (should you choose to use it)
|
|
|
- 'menu' => __( 'The Main Menu', 'bonestheme' ), // nav name
|
|
|
- 'menu_class' => 'nav top-nav clearfix', // adding custom nav class
|
|
|
- 'theme_location' => 'main-nav', // where it's located in the theme
|
|
|
- 'before' => '', // before the menu
|
|
|
- 'after' => '', // after the menu
|
|
|
- 'link_before' => '', // before each link
|
|
|
- 'link_after' => '', // after each link
|
|
|
- 'depth' => 0, // limit the depth of the nav
|
|
|
- 'fallback_cb' => 'bones_main_nav_fallback' // fallback function
|
|
|
- ));
|
|
|
-} /* end bones main nav */
|
|
|
-
|
|
|
-// the footer menu (should you choose to use one)
|
|
|
-function bones_footer_links() {
|
|
|
- // display the wp3 menu if available
|
|
|
- wp_nav_menu(array(
|
|
|
- 'container' => '', // remove nav container
|
|
|
- 'container_class' => 'footer-links clearfix', // class of container (should you choose to use it)
|
|
|
- 'menu' => __( 'Footer Links', 'bonestheme' ), // nav name
|
|
|
- 'menu_class' => 'nav footer-nav clearfix', // adding custom nav class
|
|
|
- 'theme_location' => 'footer-links', // where it's located in the theme
|
|
|
- 'before' => '', // before the menu
|
|
|
- 'after' => '', // after the menu
|
|
|
- 'link_before' => '', // before each link
|
|
|
- 'link_after' => '', // after each link
|
|
|
- 'depth' => 0, // limit the depth of the nav
|
|
|
- 'fallback_cb' => 'bones_footer_links_fallback' // fallback function
|
|
|
- ));
|
|
|
-} /* end bones footer link */
|
|
|
-
|
|
|
-// this is the fallback for header menu
|
|
|
-function bones_main_nav_fallback() {
|
|
|
- wp_page_menu( array(
|
|
|
- 'show_home' => true,
|
|
|
- 'menu_class' => 'nav top-nav clearfix', // adding custom nav class
|
|
|
- 'include' => '',
|
|
|
- 'exclude' => '',
|
|
|
- 'echo' => true,
|
|
|
- 'link_before' => '', // before each link
|
|
|
- 'link_after' => '' // after each link
|
|
|
- ) );
|
|
|
-}
|
|
|
-
|
|
|
-// this is the fallback for footer menu
|
|
|
-function bones_footer_links_fallback() {
|
|
|
- /* you can put a default here if you like */
|
|
|
-}
|
|
|
-
|
|
|
/*********************
|
|
|
RELATED POSTS FUNCTION
|
|
|
*********************/
|
|
|
@@ -285,7 +200,7 @@ function bones_related_posts() {
|
|
|
global $post;
|
|
|
$tags = wp_get_post_tags( $post->ID );
|
|
|
if($tags) {
|
|
|
- foreach( $tags as $tag ) {
|
|
|
+ foreach( $tags as $tag ) {
|
|
|
$tag_arr .= $tag->slug . ',';
|
|
|
}
|
|
|
$args = array(
|
|
|
@@ -312,26 +227,24 @@ PAGE NAVI
|
|
|
|
|
|
// Numeric Page Navi (built into the theme by default)
|
|
|
function bones_page_navi() {
|
|
|
- global $wp_query;
|
|
|
- $bignum = 999999999;
|
|
|
- if ( $wp_query->max_num_pages <= 1 )
|
|
|
- return;
|
|
|
-
|
|
|
- echo '<nav class="pagination">';
|
|
|
-
|
|
|
- echo paginate_links( array(
|
|
|
- 'base' => str_replace( $bignum, '%#%', esc_url( get_pagenum_link($bignum) ) ),
|
|
|
- 'format' => '',
|
|
|
- 'current' => max( 1, get_query_var('paged') ),
|
|
|
- 'total' => $wp_query->max_num_pages,
|
|
|
- 'prev_text' => '←',
|
|
|
- 'next_text' => '→',
|
|
|
- 'type' => 'list',
|
|
|
- 'end_size' => 3,
|
|
|
- 'mid_size' => 3
|
|
|
- ) );
|
|
|
-
|
|
|
- echo '</nav>';
|
|
|
+ global $wp_query;
|
|
|
+ $bignum = 999999999;
|
|
|
+ if ( $wp_query->max_num_pages <= 1 )
|
|
|
+ return;
|
|
|
+
|
|
|
+ echo '<nav class="pagination">';
|
|
|
+ echo paginate_links( array(
|
|
|
+ 'base' => str_replace( $bignum, '%#%', esc_url( get_pagenum_link($bignum) ) ),
|
|
|
+ 'format' => '',
|
|
|
+ 'current' => max( 1, get_query_var('paged') ),
|
|
|
+ 'total' => $wp_query->max_num_pages,
|
|
|
+ 'prev_text' => '←',
|
|
|
+ 'next_text' => '→',
|
|
|
+ 'type' => 'list',
|
|
|
+ 'end_size' => 3,
|
|
|
+ 'mid_size' => 3
|
|
|
+ ) );
|
|
|
+ echo '</nav>';
|
|
|
} /* end page navi */
|
|
|
|
|
|
/*********************
|
|
|
@@ -350,22 +263,6 @@ function bones_excerpt_more($more) {
|
|
|
return '... <a class="excerpt-read-more" href="'. get_permalink($post->ID) . '" title="'. __( 'Read', 'bonestheme' ) . get_the_title($post->ID).'">'. __( 'Read more »', 'bonestheme' ) .'</a>';
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
- * This is a modified the_author_posts_link() which just returns the link.
|
|
|
- *
|
|
|
- * This is necessary to allow usage of the usual l10n process with printf().
|
|
|
- */
|
|
|
-function bones_get_the_author_posts_link() {
|
|
|
- global $authordata;
|
|
|
- if ( !is_object( $authordata ) )
|
|
|
- return false;
|
|
|
- $link = sprintf(
|
|
|
- '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
|
|
|
- get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
|
|
|
- esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), // No further l10n needed, core will take care of this one
|
|
|
- get_the_author()
|
|
|
- );
|
|
|
- return $link;
|
|
|
-}
|
|
|
+
|
|
|
|
|
|
?>
|