show count in dropdown menu
<p>I'm trying to show count in a dropdown menu level but I cannot get it work. </p>

<p>Any help would be greatly appreciated.</p>

<p>Here is the code I'm working on:</p>

<pre><code>function shandora_search_manufacturer_level2_field($value = array(), $class) {

$o = apply_atomic('search_manufacturer_level2_field', '', $value, $class );

if( $o != '' ) {
    return $o;
}

global $bon;
$form = $bon-&gt;form();

$loc_opt = array('any' =&gt; __('Any','bon'));

if($value['manufacturer_level1'] != '') {
    $parent = get_term_by('slug', $value['manufacturer_level1'], 'manufacturer');
    if($parent) {
        $terms = get_terms('manufacturer', array('parent' =&gt; $parent-&gt;term_id, 'hide_empty' =&gt; true, 'show_count' =&gt; 1, 'show_lisiting_count' =&gt; true, ) );
        if($terms) {
            foreach($terms as $term) {
                $loc_opt[$term-&gt;slug] = $term-&gt;name;
                $show_listing_count = bon_get_option('show_listing_count', 'yes');
                $term-&gt;name . '&amp;nbsp;(' . $term-&gt;count . ')';
            }
        }
    }
}

$o = $form-&gt;form_label(bon_get_option('manufacturer_level2_label'), 'manufacturer_level2');
$o .= $form-&gt;form_dropdown('manufacturer_level2', $loc_opt, $value['manufacturer_level2'], 'class="'.$class.'"');
if ( !empty( $terms ) &amp;&amp; !is_wp_error( $terms ) ){
    echo '&lt;ul&gt;';
    foreach ( $terms as $term ) {
       echo '&lt;li&gt;' . $term-&gt;name . '&amp;nbsp;(' . $term-&gt;count . ')' . '&lt;/li&gt;';
    }
    echo '&lt;/ul&gt;';
} 

return apply_atomic( 'search_manufacturer_level2_field_output', $o );

}
</code></pre>