Forums

[resolved] Category ID (5 posts)

  1. ozgression
    Member
    Posted 4 years ago #

    Hi, is there a way to output the category ID in the Archive template? This will need to be done outside the loop.

    For example: Uncategorized's category ID is 1. I want to display in the Acrhive template, when viewing the Uncategorized category something like...

    Category Number: 1

    Can someone help me with this?

    Cheers...

  2. whooami
    Member
    Posted 4 years ago #

  3. ozgression
    Member
    Posted 4 years ago #

    Thanks.

    My php skills are a bit limited. How do I actually use:

    get_query_var('cat');

    to display the number on the page?

  4. whooami
    Member
    Posted 4 years ago #

    <?php echo get_query_var('cat'); ?>

    on a category page, that will echo back the id

  5. tlsceo
    Member
    Posted 4 years ago #

    is there a way that I can use get_query_var('cat'); to pass the current category ID to wp_list_cats in order to display only children of the current category?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags