/**
* 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 '
';
echo '
' . $term->name .'
';
foreach($term_children as $term_child_id) {
// We'll list out each term and also display any child taxonomy terms
$term_child = get_term_by('id',$term_child_id,$taxonomy);
echo '