prefix; $pc_header = get_option('pc_header'); $sort_code = 'ORDER BY name ASC, post_title ASC'; $the_output = NULL; /* fetch posts, categories from mysql and sort by category, then by post */ $last_posts = (array)$wpdb->get_results(" select ID, post_date, post_title, post_status, name from {$table_prefix}posts, {$table_prefix}terms, {$table_prefix}term_relationships, {$table_prefix}term_taxonomy where {$table_prefix}posts.ID = {$table_prefix}term_relationships.object_id and {$table_prefix}term_relationships.term_taxonomy_id = {$table_prefix}term_taxonomy.term_taxonomy_id and {$table_prefix}term_taxonomy.term_id = {$table_prefix}terms.term_id and post_status = 'publish' and taxonomy = 'category' and post_date < NOW() order by name asc, post_title asc; "); if (empty($last_posts)) { return NULL; } /* this is what we print out on archives page */ $the_output .= stripslashes($ddle_header); /* print links and if category post_title; $category = $posts->name; $post_number = $posts->ID; if ( $category != $last_category ){ $the_output .= '
  • ' . $category . '

  • '; $last_category = $category; } $the_output .= '
  • ' . $title . '
  • '; } return $the_output; } /* this allows users to just put in a post or page and not hack the template */ function pc_generate_local($content) { $content = str_replace("", archives_by_category(), $content); return $content; } add_filter('the_content', 'pc_generate_local'); ?>