Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $query = "SELECT $wpdb->terms.term_id AS id, name, slug, description
- FROM $wpdb->terms
- INNER JOIN $wpdb->term_taxonomy ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id
- AND $wpdb->term_taxonomy.taxonomy = 'category'
- AND $wpdb->term_taxonomy.parent = 0;
- AND $wpdb->term_taxonomy.count > 0;
- ";
- $results = $wpdb->get_results($query);
- foreach ($results as $result) :
- echo "<h3>$result->name ($result->slug) </h3>";
- query_posts("cat=$result->id");
- if (have_posts()) : while (have_posts()) : the_post();
- the_title();
- echo "<br/>";
- endwhile; endif;
- endforeach;
- ?>
Add Comment
Please, Sign In to add comment