get_results(”
SELECT $wpdb->terms.name, $wpdb->terms.term_id
FROM $wpdb->terms, $wpdb->term_taxonomy
WHERE $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id
AND $wpdb->term_taxonomy.taxonomy = ‘category’
{$hide_check}
“);
if ( empty($last_posts) )
return NULL;
$used_cats = array();
$i = 0;
foreach ($last_posts as $posts) {
if ( in_array($posts->name, $used_cats) ) {
unset($last_posts[$i]);
} else {
$used_cats[] = $posts->name;
}
$i++;
}
$last_posts = array_values($last_posts);
//$the_output .= ‘
- ‘;
- term_id) . ‘”>’ . apply_filters(‘list_cats’, $posts->name, $posts) . ‘‘;
$where = apply_filters(‘getarchives_where’, “WHERE post_type = ‘post’ AND post_status = ‘publish'” , $r );if (‘-1’ !== $mylimit)
$limit = ‘ LIMIT ‘ . (int) $mylimit;
else
$limit = ”;$arcresults = $wpdb->get_results(“SELECT ID, post_title FROM $wpdb->posts WHERE post_type = ‘post’ AND post_status = ‘publish’ AND ID IN (Select object_id FROM $wpdb->term_relationships, $wpdb->terms WHERE $wpdb->term_relationships.term_taxonomy_id =” . $posts->term_id . “) ORDER BY post_date DESC$limit”);
if (isset($arcresults) && $arcresults) {
$the_output .= ‘- ‘;
- ID) . ‘”>’ . apply_filters(‘the_title’, $arcresult->post_title) . ‘
- term_id).'”>More…
foreach ( $arcresults as $arcresult ) {
$class = ‘post-item post-item-‘ . $arcresult->ID;
$current_post = get_the_ID();
if ( isset($current_post) && $current_post && is_singular() && ($arcresult->ID == $current_post) )
$class .= ‘ current-post’;$the_output .= ‘
‘;
}
$the_output .= ‘‘;
}$the_output .= ‘
foreach ($last_posts as $posts) {
$class = ‘cat-item cat-item-‘ . $posts->term_id;
$catsy = get_the_category();
$current_category = $catsy[0]->cat_ID;
if ( isset($current_category) && $current_category && ($posts->term_id == $current_category) )
$class .= ‘ current-cat’;
elseif ( isset($_current_category) && $_current_category && ($posts->term_id == $_current_category->parent) )
$class .= ‘ current-cat-parent’;
$the_output .= ‘
‘;
}
//$the_output .= ‘
‘;
echo $the_output;
}
?>