__('Topbar Navigation','best'), ) ); // Fallback function for Pages Navigation if it isn't set function best_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args','best_page_menu_args' ); // This theme uses Featured Images (also known as post thumbnails) add_theme_support( 'post-thumbnails' ); // This feature enables post and comment RSS feed links to head add_theme_support( 'automatic-feed-links' ); // Custom backgrounds support $defaults_bg = array( 'default-color' => '#eeeeee', 'default-image' => '', 'wp-head-callback' => 'best_custom_background_callback', 'admin_head_callback' => '', 'admin_preview_callback' => '' ); add_theme_support ( 'custom-background', $defaults_bg ); // Custom header support $defaults_hd = array( 'default-color' => '#eeeeee', 'default-image' => '', 'wp-head-callback' => '', 'upload' => true, 'admin_head_callback' => '', 'admin_preview_callback' => 'best_admin_header_img' ); add_theme_support ( 'custom-header', $defaults_hd ); add_editor_style(''); // Clean up the remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'wp_generator'); /* ============================================================= * Author: Boutros AbiChedid * Date: March 20, 2011 * Websites: http://bacsoftwareconsulting.com/, http://blueoliveonline.com/ * Description: Numbered Page Navigation (Pagination) Code. * Tested: Up to WordPress version 3.1.2 (also works on WP 3.3.1) * ============================================================= */ /* Function that Rounds To The Nearest Value. Needed for the pagenavi() function */ function round_num($num, $to_nearest) { /*Round fractions down (http://php.net/manual/en/function.floor.php)*/ return floor($num/$to_nearest)*$to_nearest; } /* Function that performs a Boxed Style Numbered Pagination (also called Page Navigation). Function is largely based on Version 2.4 of the WP-PageNavi plugin */ function pagenavi($before = '', $after = '') { global $wpdb, $wp_query; $pagenavi_options = array(); $pagenavi_options['pages_text'] = ('Page %CURRENT_PAGE% of %TOTAL_PAGES%'); $pagenavi_options['current_text'] = '%PAGE_NUMBER%'; $pagenavi_options['page_text'] = '%PAGE_NUMBER%'; $pagenavi_options['first_text'] = ('First Page'); $pagenavi_options['last_text'] = ('Last Page'); $pagenavi_options['next_text'] = 'Next »'; $pagenavi_options['prev_text'] = '« Previous'; $pagenavi_options['dotright_text'] = '...'; $pagenavi_options['dotleft_text'] = '...'; $pagenavi_options['num_pages'] = 3; //continuous block of page numbers $pagenavi_options['always_show'] = 0; $pagenavi_options['num_larger_page_numbers'] = 0; $pagenavi_options['larger_page_numbers_multiple'] = 3; //If NOT a single Post is being displayed /*http://codex.wordpress.org/Function_Reference/is_single)*/ if (!is_single()) { $request = $wp_query->request; //intval — Get the integer value of a variable /*http://php.net/manual/en/function.intval.php*/ $posts_per_page = intval(get_query_var('posts_per_page')); //Retrieve variable in the WP_Query class. /*http://codex.wordpress.org/Function_Reference/get_query_var*/ $paged = intval(get_query_var('paged')); $numposts = $wp_query->found_posts; $max_page = $wp_query->max_num_pages; //empty — Determine whether a variable is empty /*http://php.net/manual/en/function.empty.php*/ if(empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = intval($pagenavi_options['num_pages']); $larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']); $larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']); $pages_to_show_minus_1 = $pages_to_show - 1; $half_page_start = floor($pages_to_show_minus_1/2); //ceil — Round fractions up (http://us2.php.net/manual/en/function.ceil.php) $half_page_end = ceil($pages_to_show_minus_1/2); $start_page = $paged - $half_page_start; if($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if(($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if($start_page <= 0) { $start_page = 1; } $larger_per_page = $larger_page_to_show*$larger_page_multiple; //round_num() custom function - Rounds To The Nearest Value. $larger_start_page_start = (round_num($start_page, 10) + $larger_page_multiple) + $larger_per_page; $larger_start_page_end = round_num($start_page, 10) + $larger_page_multiple; $larger_end_page_start = round_num($end_page, 10) + $larger_page_multiple; $larger_end_page_end = round_num($end_page, 10) + ($larger_per_page); if($larger_start_page_end - $larger_page_multiple == $start_page) { $larger_start_page_start = $larger_start_page_start - $larger_page_multiple; $larger_start_page_end = $larger_start_page_end - $larger_page_multiple; } if($larger_start_page_start <= 0) { $larger_start_page_start = $larger_page_multiple; } if($larger_start_page_end > $max_page) { $larger_start_page_end = $max_page; } if($larger_end_page_end > $max_page) { $larger_end_page_end = $max_page; } if($max_page > 1 || intval($pagenavi_options['always_show']) == 1) { /*http://php.net/manual/en/function.str-replace.php */ /*number_format_i18n(): Converts integer number to format based on locale (wp-includes/functions.php*/ $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']); $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text); echo $before.'
'.$after."\n"; // added
if there are posts for responsive layout } } } // Adds classes to "Previous" and "Next" buttons in pagination add_filter('next_posts_link_attributes', 'posts_link_attributes'); add_filter('previous_posts_link_attributes', 'posts_link_attributes'); function posts_link_attributes() { return 'class="prev-next"'; } /* ===| end pagination |================================ */ } /* ===| end best_setup() |================================== */ } /* ===| end !function_exists |================================== */ /* ============================================================= * Filter function for wp_title * ============================================================= */ function _filter_wp_title( $old_title, $sep, $sep_location ){ $ssep = ' ' . $sep . ' '; if( is_category() ) $insert = $ssep . __('Category','best'); elseif( is_tag() ) $insert = $ssep . __('Tag','best'); elseif( is_author() ) $insert = $ssep . __('Author','best'); elseif( is_year() || is_month() || is_day() ) $insert = $ssep . __('Archives','best'); elseif( is_home() ) $insert = $ssep . get_bloginfo('description'); else $insert = NULL; if( get_query_var( 'paged' ) ) $num = $ssep . __('Page','best') . get_query_var( 'paged' ); elseif( get_query_var( 'page' ) ) $num = $ssep . __('Page ','best') . get_query_var( 'page' ); else $num = NULL; return get_bloginfo( 'name' ) . $insert . $old_title . $num; } add_filter( 'wp_title', '_filter_wp_title', 10, 3 ); /* ============================================================= * Enqueue Styles * ============================================================= */ add_action( 'wp_enqueue_scripts', 'load_best_styles' ); if ( !function_exists( 'load_best_styles' ) ) { function load_best_styles() { if ( !is_admin() ) { wp_register_style( 'best-styles', get_template_directory_uri() . '/style.css', array() ); wp_enqueue_style( 'best-styles' ); wp_register_style( 'old-styles', get_template_directory_uri() . '/oldstyle.css', array() ); wp_enqueue_style( 'old-styles' ); } } /* ===| end load_best_scripts() |=========================== */ } /* ============================================================= * Enqueue Javascript * ============================================================= */ add_action( 'wp_enqueue_scripts', 'load_best_scripts' ); if ( !function_exists( 'load_best_scripts' ) ) { function load_best_scripts() { if ( !is_admin() ) { wp_enqueue_script( 'jquery' ); wp_register_script( 'modernizr', get_template_directory_uri() . '/js/libs/modernizr.min.js' ); wp_enqueue_script( 'modernizr' ); wp_register_script( 'best-plugins', get_template_directory_uri() . '/js/plugins.js', array('jquery'), '', true ); wp_enqueue_script( 'best-plugins' ); wp_register_script( 'best-scripts', get_template_directory_uri() . '/js/scripts.js', array('jquery'), '', true ); wp_enqueue_script( 'best-scripts' ); wp_register_script( 'best-slider', get_template_directory_uri() . '/js/slider.js', array('jquery'), '', true ); if ( is_front_page() || is_home() ) wp_enqueue_script( 'best-slider' ); if ( is_single() ) wp_enqueue_script( 'comment-reply' ); } } /* ===| end load_best_scripts() |=========================== */ } /* ============================================================= * Function custom background callback * ============================================================= */ function best_custom_background_callback() { /* Get the background image. */ $image_bg = get_background_image(); /* If there's an image, just call the normal WordPress callback. We won't do anything here. */ if ( !empty( $image_bg ) ) { _custom_background_cb(); return; } /* Get the background color. */ $color_bg = get_background_color(); /* If no background color, return. */ if ( empty( $color_bg ) ) return; /*Use 'background' instead of 'background-color'. */ $style_bg = "background: #{color};"; ?>

onclick="return false;" href="">

>
'.__('Read More', 'best').'»'; } } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); add_filter('excerpt_more', 'new_excerpt_more'); /* ============================================================= * Tweak tagcloud settings * ============================================================= */ if ( !function_exists( 'custom_tag_cloud_widget' ) ) { function custom_tag_cloud_widget( $args ) { $args['largest'] = 11; $args['smallest'] = 11; $args['unit'] = 'px'; return $args; } } add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' ); /* ============================================================= * Pull in latest tweet and date from Twitter * ============================================================= */ if ( !function_exists( 'wp_echo_twitter' ) ) { function wp_echo_twitter($username) { include_once ABSPATH . WPINC . '/class-simplepie.php'; // Fetch feed, set cache locaiton, and initialize function $feed = new SimplePie(); $feed->set_feed_url("http://search.twitter.com/search.atom?q=from:$username"); $feed->set_cache_location( ABSPATH . WPINC ); $feed->init(); $feed->handle_content_type(); // Output tweet foreach ($feed->get_items(0, 1) as $item): echo '

"' . $item->get_description() . '"

' . '' . $item->get_date('D, M j, Y') . ''; endforeach; } } ?>