=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return $excerpt; } function backyard_title_limit($length, $replacer = '...') { $string = the_title('','',FALSE); if(strlen($string) > $length) $string = (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches) ? $matches[1] : substr($string, 0, $length)) . $replacer; echo $string; } function backyard_setup() { // Register wp_nav_menu() menus (http://codex.wordpress.org/Function_Reference/register_nav_menus) register_nav_menus(array( 'primary_navigation' => __('Primary Navigation', 'backyard'), )); add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_image_size( 'backyard-widget-thumb', 80, 50, true ); add_image_size('backyard-related-post', 230, 166, true); add_image_size('backyard-featured-categories', 263, 190, true ); add_image_size('backyard-popular-thumb', 256, 151, true ); add_image_size('backyard-post-thumb', 750, 387, true ); add_image_size('backyard-full-grid', 550, 350, true ); add_theme_support( 'automatic-feed-links' ); add_editor_style(array('editor-style.css', backyard_google_web_fonts_url())); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); $args = array( 'default-text-color' => 'e1a232', 'default-image' => '', 'height' => 250, 'width' => 1060, 'max-width' => 2000, 'flex-height' => true, 'flex-width' => true, 'random-default' => false, 'wp-head-callback' =>'backyard_header_style', ); add_theme_support('custom-logo', array( 'height' => 100, 'width' => 300, 'flex-width' => true, 'flex-height' => true, )); add_theme_support('custom-header', apply_filters('backyard_custom_header_args',$args)); add_theme_support( 'custom-background', $args); } add_action('after_setup_theme', 'backyard_setup'); //* Add custom body class to the head add_filter('body_class', 'sp_body_class'); function sp_body_class( $classes ) { if (!is_front_page() || is_home()) $classes[] = 'inner-page'; return $classes; } /*Start Content Limit Function*/ /*End Content Limit Function*/ /*Start Popular Posts Function*/ function backyard_set_post_views($postID) { $count_key = 'backyard_post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{ $count++; update_post_meta($postID, $count_key, $count); } } //To keep the count accurate, lets get rid of prefetching remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); function backyard_track_post_views ($post_id) { if ( !is_single() ) return; if ( empty ( $post_id) ) { global $post; $post_id = $post->ID; } backyard_set_post_views($post_id); } add_action( 'wp_head', 'backyard_track_post_views'); function backyard_get_post_views($postID){ $count_key = 'backyard_post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); return "0 View"; } return $count.' Views'; } /*Start Search Form Hook*/ function backyard_search_form($form) { $form = '
'; return $form; } add_filter( 'get_search_form', 'backyard_search_form'); /*End Search Form Hook*/ if(!function_exists('Backyard_comment_nav')) : function backyard_comment_nav() { // Are there comments to navigate through? if ( get_comment_pages_count() > 1 && get_option('page_comments') ) : ?>