prefix;
$pc_header = get_option('pc_header');
$sort_code = 'ORDER BY name ASC, post_date DESC';
$the_output = NULL;
$last_posts = (array)$wpdb->get_results("
SELECT {$tp}terms.name, {$tp}terms.term_id
FROM {$tp}terms, {$tp}term_taxonomy
WHERE {$tp}terms.term_id = {$tp}term_taxonomy.term_id
AND {$tp}term_taxonomy.taxonomy = 'category'
{$hide_check}
");
if (empty($last_posts)) {return NULL;}
$the_output .= stripslashes($ddle_header);
$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);
foreach ($last_posts as $posts) {
$the_output .= '
' . apply_filters('list_cats', $posts->name, $posts) . '
';
$where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'" , $r );
$arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND ID IN (Select object_id FROM {$tp}term_relationships, {$tp}terms WHERE {$tp}term_relationships.term_taxonomy_id =" . $posts->term_id . ") ORDER BY post_date DESC");
foreach ( $arcresults as $arcresult ) {
$the_output .= ' ' . apply_filters('the_title', $arcresult->post_title) . '';
}
$the_output .= '';
}
return $the_output;
}
?>