0

Please, someone can help?! I'm fighting with this for weeks and nothing.... I'm quite new in wordpress and php...

There is a way to list taxonomy terms based on another taxonomy? OR If is possible to list taxonomies based on post category.

BUT, I'm doing this on homepage, not post page...

The function above retrieve my all my taxonomy terms, but how or where filter this?

function dox_get_list_terms( $taxonomy = 'category', $term_id, $number, $orderby = 'ID', $order = 'ASC', $hide = '0' ) {        

        global $dox_options;

        $terms = array();
        $terms = explode(',', $term_id);
        $count = count( $terms );

        $output = '';
        foreach( $terms as $term ) {
            if ($term >= 0) {
                $options = get_terms( $taxonomy, 'number='.$number.'child_of='.$term.'&parent='.$term.'&hide_empty='.$hide.'&hierarchical=1&depth=1&orderby='.$orderby.'&order='.$order );
                if (! is_wp_error($options) ) {
                    foreach ($options as $option) {
                        $output .= '<li>'. $option->name .'</li>';
                        }
                    }
                }
            }
        }

        return $output;
}

1 Answer 1

0

If you are trying to print children of a category, this should be sufficient:

<?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of='.$term_id); ?>

Details here: http://codex.wordpress.org/Template_Tags/wp_list_categories

1
  • Thanks Kakoma, this could open my mind and I resolved with your help!
    – Santoro
    Commented Jun 13, 2012 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.