/** * returns taxonomy lists that have children with checkboxes * */ function get_subject_list($taxonomy){ // Sets the taxonomy to pull a list of terms from. // Throws them into a nifty object for referencing and counting $terms = get_terms($taxonomy,array('parent' => 0)); if ($terms) { // For each term we will create some html for use in styling // and additional hooks for functionality foreach($terms as $term) { // We can return a variety of things to enhance functionality // Here we are returning the slug for use as a class (useful for setting up module specific sprites n etc) echo '
'; // Here we are returning the term name to be used as a unique identifier for this set of checkboxes echo ''; // Here we extend that by also passing the number of items that are within the section that are published. echo '
'; // We set the variable for any child terms echo ''; $term_children = get_term_children($term->term_id,$taxonomy); if ( count( get_term_children( $term->term_id, $taxonomy ) ) > 0 ) { // The term has children display nothing echo ''; } if ( count( get_term_children( $term->term_id, $taxonomy ) ) === 0 ) { // The term has no children display nothing } } } }