• Resolved WPChina

    (@wordpresschina)


    I’m trying to print out the parent category with links of a sub category so it looks like this:

    Parent 1 >> Sub 1

    In the Codex I found this:

    <?php echo(get_category_parents($cat, TRUE, ' &raquo; ')); ?>

    However it is not printing anything–just blank.

    What code should I use to mark this up in PHP?

    Tks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter WPChina

    (@wordpresschina)

    Sorry for the bump, but I know this is a simple thing to do and I’m just stumped right now… the info in the Codex isn’t working for me on WP2.2 ??

    Where my child category is 4, this works for me:
    <?php echo(get_category_parents('4', TRUE, ' &raquo; ')); ?>

    Thread Starter WPChina

    (@wordpresschina)

    Thank you MichaelH. Ok I see what I did wrong–I left off the number of the cat id and instead used the name. ??

    Cheers for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to show parent category names?’ is closed to new replies.