Guest User

Untitled

a guest
Jun 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php $query = "SELECT $wpdb->terms.term_id AS id, name, slug, description
  2. FROM $wpdb->terms
  3. INNER JOIN $wpdb->term_taxonomy ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id
  4. AND $wpdb->term_taxonomy.taxonomy = 'category'
  5. AND $wpdb->term_taxonomy.parent = 0;
  6. AND $wpdb->term_taxonomy.count > 0;
  7. ";
  8.  
  9.  
  10.  
  11. $results = $wpdb->get_results($query);
  12.  
  13. foreach ($results as $result) :
  14. echo "<h3>$result->name ($result->slug) </h3>";
  15. query_posts("cat=$result->id");
  16. if (have_posts()) : while (have_posts()) : the_post();
  17. the_title();
  18. echo "<br/>";
  19. endwhile; endif;
  20. endforeach;
  21.  
  22. ?>
Add Comment
Please, Sign In to add comment