(.*?)<\/code>/ims', create_function('$matches', '$matches[1] = preg_replace(array("/^[\r|\n]+/i", "/[\r|\n]+$/i"), "", $matches[1]); return "" . htmlentities($matches[1]) . "";'), $source); if ($encoded) return $encoded; else return $source; } // remove nofollow from comments function xwp_dofollow($str) { $str = preg_replace( '~]*)\s*(["|\']{1}\w*)\s*nofollow([^>]*)>~U', '', $str); return str_replace(array(' rel=""', " rel=''"), '', $str); } /** */ // Additional Admin Styles and custom Branding function admin_register_head() { $url = get_bloginfo('template_directory') . '/css/admin.css'; echo ''; } /** */ function custom_admin_footer() { echo 'Theme created by New2WP'; } /** * Remove [...] from excerpts */ function trim_excerpt($text) { return rtrim($text,'[...]'); } /** * Remove version info from head and feeds */ function complete_version_removal() { return ''; } /** * List the terms for Categories taxonomy */ function category_terms_list() { // uses wp_list_categories with Categories taxonomy parameter wp_list_categories( array( 'style' => 'list', 'hide_empty' => 0, 'taxonomy' => 'categories', 'hierarchical' => true, 'title_li' => __( 'Categories' ) ) ); return; } /** * List the terms for Tags taxonomy */ function tags_terms_list() { // uses wp_list_categories with Tags taxonomy parameter wp_list_categories( array( 'style' => 'list', 'hide_empty' => 0, 'taxonomy' => 'post_tags', 'hierarchical' => true, 'title_li' => __( 'Tags' ) ) ); return; } /** * Get user avatar */ function member_get_avatar( $wpcom_user_id, $email, $size, $rating = '', $default = 'http://s.wordpress.com/i/mu.gif' ) { if( !empty( $wpcom_user_id ) && $wpcom_user_id !== false && function_exists( 'get_avatar' ) ) { return get_avatar( $wpcom_user_id, $size ); } elseif( !empty( $email ) && $email !== false ) { $default = urlencode( $default ); $out = 'http://www.gravatar.com/avatar.php?gravatar_id='; $out .= md5( $email ); $out .= "&size={$size}"; $out .= "&default={$default}"; if( !empty( $rating ) ) { $out .= "&rating={$rating}"; } return ""; } else { return ""; } } /** * Post pagination function * * @param integer $range: The range of the slider, works best with even numbers * get_pagenum_link($i) - creates the link, e.g. http://site.com/page/4 * previous_posts_link(' « '); - returns the Previous page link * next_posts_link(' » '); - returns the Next page link */ function get_pagination( $range = 5 ) { // $paged - number of the current page global $paged, $wp_query; // How much pages do we have? if ( !$max_page ) { $max_page = $wp_query->max_num_pages; } // We need the pagination only if there are more than 1 page if($max_page > 1){ if(!$paged){ $paged = 1; } // On the first page, don't put the First page link if($paged != 1){ echo " First "; } // To the previous page previous_posts_link(' « '); // add before // We need the sliding effect only if there are more pages than is the sliding range if($max_page > $range){ // When closer to the beginning if($paged < $range){ for($i = 1; $i <= ($range + 1); $i++){ echo "$i"; } } // When closer to the end elseif($paged >= ($max_page - ceil(($range/2)))){ for($i = $max_page - $range; $i <= $max_page; $i++){ echo "$i"; } } // Somewhere in the middle elseif($paged >= $range && $paged < ($max_page - ceil(($range/2)))){ for($i = ($paged - ceil($range / 2)); $i <= ($paged + ceil(($range/2))); $i++){ echo "$i"; } } } // Less pages than the range, no sliding effect needed else{ for($i = 1; $i <= $max_page; $i++){ echo "$i"; } } // Next page next_posts_link(' » '); // add after // On the last page, don't put the Last page link if($paged != $max_page){ echo " Last "; } } } // end of pagination function() ?>