Howe to show just children category? (3 posts)

  1. dados
    Posted 4 years ago #

    Hi, can you please help me somebody, I try to call in template to show just children category, for example I have category CAR and in this category I have 5 subcategory ford, Audi etc... (children category) and I need to show on widget or on sidebar just this 5 children category. I try something with code

    <?php echo get_category_parents(category, display link, separator, nice name); ?>

    bur I get error

    Catchable fatal error: Object of class WP_Error could not be converted to string in....

    Can somebody help me?

  2. Andrei Olsen
    Posted 4 years ago #

    get_category_parents returns a list of the parents of a category.

    As I understood you, you're looking for a way to display categories that are children of the specific category. So, you want something like:

    <?php wp_list_categories('child_of=PARENT-ID'); ?>

  3. dados
    Posted 4 years ago #

    Thank you very much, its very easy.. I am shame now...

Topic Closed

This topic has been closed to new replies.

About this Topic