Title: WP LIST CATS help please
Last modified: August 18, 2016

---

# WP LIST CATS help please

 *  [elyonline](https://wordpress.org/support/users/elyonline/)
 * (@elyonline)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/)
 * Hi there,
 * I am looking at wp list cats: [http://codex.wordpress.org/Template_Tags/wp_list_cats](http://codex.wordpress.org/Template_Tags/wp_list_cats)
   but I can’t see anywhere that it will let me list all cats on an archive page
   like so:WordPress, Computers, Blogging, etc,
 * Any ideas?
 * Thanks

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [lobsterman](https://wordpress.org/support/users/lobsterman/)
 * (@lobsterman)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373427)
 * just use wp_list_cats()
 *  Thread Starter [elyonline](https://wordpress.org/support/users/elyonline/)
 * (@elyonline)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373431)
 * Nope, that lists the cats in a list < u l >, I want Computers, Blogging, etc,
   in a < p > tag.
 * Thanks
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373438)
 * You’ll need some custom code to get what you’re after:
 * `<?php
    global $wpdb; $thecats = $wpdb->get_results("SELECT * FROM $wpdb->categories
   WHERE category_count > 0 ORDER BY cat_name ASC"); $eor = count($thecats) - 1;
   foreach($thecats as $thecat) : ?> <a href="<?php echo get_category_link($thecat-
   >cat_ID); ?>" title="<?php echo wp_specialchars($thecat->category_description);?
   >"><?php echo $thecat->cat_name; ?></a><?php if($thecats[$eor] != $thecat) echo',';?
   > <?php endforeach; ?>
 * This would take the place of `<?php wp_list_cats(); ?>` in your template.
 *  Thread Starter [elyonline](https://wordpress.org/support/users/elyonline/)
 * (@elyonline)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373454)
 * Hi Kafkaesqui,
 * Many thanks for the code 🙂
 * I am not sure if I am doing something wrong though as this just makes myarchive
   page white with no code on it.
 * Thanks
    Karl
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373574)
 * I tested the code block above, but one can never be %100 sure…
 * It’s probably just bad placement of the code. Pop your template’s source up here:
   [http://pastebin.co.uk/](http://pastebin.co.uk/) (click New Post at the top),
   and reply back with the link to it.
 *  Thread Starter [elyonline](https://wordpress.org/support/users/elyonline/)
 * (@elyonline)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373732)
 * Hi Kafkaesqui,
 * Here is the link: [http://pastebin.co.uk/603](http://pastebin.co.uk/603)
 * There is not much on this page so I guess it might conflict with smart archives:
   [http://justinblanton.com/projects/smartarchives/](http://justinblanton.com/projects/smartarchives/)
   so that may be where the conflict is.
 * If this is too much work I fully understand.
 * Many thanks
    Karl
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373783)
 * This is working for me:
 * [http://pastebin.co.uk/605](http://pastebin.co.uk/605)
 * I guessed at the placement of my code. I assumed you would want the category 
   listing just above the output from Smart Archives.
 *  Thread Starter [elyonline](https://wordpress.org/support/users/elyonline/)
 * (@elyonline)
 * [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373890)
 * Kafkaesqui,
 * Thank you so much, I had been wanting to do this for so long and was sure there
   was a plugin. There wasn’t, so you are a life saver.
 * Thank you
    Karl

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘WP LIST CATS help please’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 3 participants
 * Last reply from: [elyonline](https://wordpress.org/support/users/elyonline/)
 * Last activity: [20 years ago](https://wordpress.org/support/topic/wp-list-cats-help-please/#post-373890)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
