trim($style[1]), 'stylelink' => trim($stylelink[1]), 'author' => trim($author[1]), 'site' => trim($site[1]), 'version' => trim($version[1]), 'comments' => trim($comments[1])); } function get_k2_ping_type($trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') { $type = get_comment_type(); switch( $type ) { case 'trackback' : return $trackbacktxt; break; case 'pingback' : return $pingbacktxt; break; } return false; } function k2countposts() { global $wpdb; $k2asidescategory = get_option('k2asidescategory'); $k2asidesposition = get_option('k2asidesposition'); $join = ''; $where = "1=1 AND post_status = 'publish'"; if (($k2asidescategory != '0') and ($k2asidesposition == '1') and ($_GET["dynamic"] != '1')) { $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) "; $where .= " AND (category_id != $k2asidescategory)"; } $query = "SELECT DISTINCT $wpdb->posts.ID FROM $wpdb->posts $join WHERE $where GROUP BY $wpdb->posts.ID"; return (int) count($wpdb->get_col($query)); } function k2countpages() { return (int) ceil(k2countposts() / get_settings('posts_per_page')); } function k2countsearchposts($uriquery = '') { $search_count = 0; $search = new WP_Query($uriquery.'&showposts=-1'); if ($search->have_posts()) { while($search->have_posts()) { $search->the_post(); $search_count++; } } return (int) $search_count; } function k2countsearchpages($uriquery) { return (int) ceil(k2countsearchposts($uriquery) / get_settings('posts_per_page')); } /* By Mark Jaquith, http://txfx.net */ function k2_nice_category($normal_separator = ', ', $penultimate_separator = ' and ') { $categories = get_the_category(); if (empty($categories)) { _e('Uncategorized','k2_domain'); return; } $thelist = ''; $i = 1; $n = count($categories); foreach ($categories as $category) { $category->cat_name = $category->cat_name; if (1 < $i && $i != $n) $thelist .= $normal_separator; if (1 < $i && $i == $n) $thelist .= $penultimate_separator; $thelist .= 'cat_name) . '">'.$category->cat_name.''; ++$i; } return apply_filters('the_category', $thelist, $normal_separator); } ?>