WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Post Category called 'Podcasts' and under it are many other sub-categories.

On a page I have titled "Podcast Categories", I would like to list all categories under the "Podcasts" category, as links to their category page. I'm fairly new to Wordpress, what would be the best way of accomplishing this?

Thank you very much!

Note: I do not want to display any kind of post content on this page, only the category name as a link. When I do google searching, I'm finding lots of info on how to post content from these categories.



          <div id="content">
              $cat = get_category_by_slug( 'podcasts' );
              $catid = $cat->ID;
              wp_list_categories( array(
                'child_of' => $catid;
              ) );
          </div><!-- /content -->

This isn't doing what I expected. It's printing out:

Parse error: syntax error, unexpected ';', expecting ')' in /path/to/page-podcast-list.php on line 49

I'm not sure what line 49 is specifically at the moment, since I'm using the Built in WordPress Editor, without line numbers unfortunately..

I'm not familiar with php for the record, but am familiar with basic programming.

share|improve this question
up vote 1 down vote accepted

You need to use wp_list_categories() (Codex ref), using the child_of argument.

Assuming you know the ID of the "Podcasts" category, e.g. 123:

wp_list_categories( array(
    'child_of' => '123'
) );

If you need to find the category ID, use get_category_by_slug (Codex ref):

$cat = get_category_by_slug( 'podcasts' );
$catid = $cat->ID;

wp_list_categories( array(
    'child_of' => $catid
) );

Rather than executing PHP from within the Page content, I would simply create a custom Page template:

  1. Copy page.php as page-podcast-list.php
  2. At the top of page-podcast-list.php put the following:


Template Name: Podcast List
  1. Look for the post content markup (e.g. <div id="post-<?php the_ID(); ?>" <php post_class(); ?>>), and replace what's inside it (should include <?php the_content(); ?>, etc.) with the $wp_list_categories() code from above.

If you have problems, copy/paste the code from page-podcast-list.php in your answer, and we'll help from there.


Your parse error is here, inside of your wp_list_categories() argument array:

'child_of' => $catid;

Should instead be:

'child_of' => $catid

(no semicolon)

share|improve this answer
Thank you sir :) – ardavis Jun 25 '11 at 19:03
I marked it as answer too soon. I think I have the page-podcast-list.php setup, but what do I now put into the page content? I'm not sure how to call the wp_list_categories from the page. – ardavis Jun 25 '11 at 19:17
Can you clarify better what it is you're trying to do? I understood your question to mean that you wanted to have a static Page that listed links to Podcast categories. Is that not correct? – Chip Bennett Jun 25 '11 at 19:23
That is correct. I'm not sure how to specify that my page needs to use the page-podcast-list.php. – ardavis Jun 25 '11 at 19:25
I just discovered I needed to add: /* Template Name: The Name of This Template */ To the top of my template. – ardavis Jun 25 '11 at 19:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.