WordPress.org

Ready to get started?Download WordPress

Forums

$category data object (3 posts)

  1. fnery
    Member
    Posted 5 years ago #

    Hello,

    I'm creating for my blog an Accordion Menu to the categories. I'm making changes on the wp-includes/class.php file.

    At a certain point now, I need to disocver is the current category has any children assigned to it. So I figured that the $category data object would have something I could you for this purpose, but I just don't seem to find the Doc for this anywhere...

    The same way that "$category->name" gives me the name of the category, is there any list to describe all the information stored under this object?

  2. MichaelH
    Member
    Posted 5 years ago #

    Might try using the template tag, wp_list_categories():

    <?php
    $mycat=3;
    $anychildren=wp_list_categories('child_of='.$mycat.'&amp;echo=0&amp;title_li=');
    if ($anychildren) {
    echo 'found children for category '.$mycat;
    }
    ?>
  3. mastermute
    Member
    Posted 4 years ago #

    MichaelH: Unfortunately this doesn't document the actual "category object" that is returned by the function. I'm also looking for the documentation of the returned category object (as well as the post object etc...

Topic Closed

This topic has been closed to new replies.

About this Topic