Support » Fixing WordPress » How to display a list of all categories on a page

  • Hi everyone,

    I’m having trouble working out how to display a list of categories on a page. I’d like to display a list of links to all my categories in a on a page.

    I want to do this because currently I’m linking only to ‘featured categories’ in my sidebar, using regular hardcoded links. I’d like to put a link under the list of featured category links to a ‘View all features’ page, which would simply list all of my blogs category links by pulling a list of categories from the database.

    Ideally I’d like to be able to right a short description under each of the category links. However for now I’d be happy with a simple list of links to all the categories.

    Does anyone know how I can do this?

    Thanks in advance for your help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Sorry to bump, but any ideas?

    Very much appreciated. And sorry if I’m being dumb but I can’t find a resolution to this anywhere.

    Hi there little fellow.

    I suppose you know how to modify your theme. The codex is usefull to search in πŸ˜‰
    in short: you may copy and paste this where you want it (e.g. in you sidebar.php-file):
    <?php wp_list_categories(); ?>

    Unfortunately that won’t give the category descriptions, only the links to each category page… though you can have it use the category descriptions as the title attribute in the anchor tag.

    I’m searching for this answer and am having no luck so far. It seems like there should be an easy way to list categories as links, with descriptions on the page under the links. If I find a way I’ll come back here and post about it.

    I’m using this (which I got from somewhere else)

    $categories = get_categories();
    foreach ($categories as $cat) {
    if ($cat->category_parent != 0) {
    echo '<span style="padding-left:10px;">';
    echo 'category_nicename.'/">'.$cat->cat_name.' ('.$cat->category_count.')';
    if ($cat->category_description != '') {
    echo ' - '.$cat->category_description;
    if ($cat->category_parent != 0) {
    echo '</span>';
    echo '

    And it indents the subcategories BUT it lists them in alpha order, not the hierarchy.


    Actually, it’s not letting me properly pass my code in πŸ™
    (using code or blockquote or backticks)


    In order to display all the used/non used categories in sidebar of a wordpress blog one need to modify below mentioned code:

    1) First download category-template.php file at local system.

    2) Open it to edit the file and change the following code:


    3) Save the file and upload it on the web server.

    One can get this file from below mentioned path:



    Sandeep Gandhi

    Hello, like others on this thread, I am looking to put a simple link in my header which will result in a page listing all Categories (and totals would be nice). I am quite surprised to find that this is not a standard WordPress feature and requires additional customization.

    The standard category widget works great but I do not understand to how to make my own link. I appreciate very much that folks here (and on other threads) have linked to the documentation but the codex does not present a step-by-step solution for this case and assumes that the reader already knows what to do with the provided code snippets. I can cut & paste with the best of them but need to know where to do it.

    Do i cut&paste:

    <?php wp_list_categories(‘
    ‘show_option_all’ => ,
    ‘orderby’ => ‘name’,
    ‘order’ => ‘ASC’,
    ‘show_last_update’ => 0,
    ‘style’ => ‘list’,
    ‘show_count’ => 0,
    ‘hide_empty’ => 1,
    ‘use_desc_for_title’ => 1,
    ‘child_of’ => 0,
    ‘feed’ => ,
    ‘feed_image’ => ,
    ‘exclude’ => ,
    ‘current_category’ => 0,
    ‘hierarchical’ => true,
    ‘title_li’ => __(‘Categories’),
    ‘echo’ => 1,
    ‘depth’ => 0
    ); ?>

    into my header.php somewhere? How do I link to this block of code? Thanks for any help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to display a list of all categories on a page’ is closed to new replies.