<label> <?php _ex('Apply to category', 'fees admin', 'WPBDM'); ?> <span class="description">(required)</span></label> </th> <td> <select name="fee[categories][categories][]" multiple="multiple" size="10"> <option value="0" <?php echo in_array(0, $post_values_categories) || empty($post_values_categories) ? 'selected="selected"' : ''; ?> ><?php _ex('* All Categories *', 'fees admin', 'WPBDM'); ?> </option> <?php $directory_categories = wpbdp_categories_list(); foreach ($directory_categories as &$dir_category) { echo _wpbdp_render_category($dir_category, $post_values_categories); } ?> </select> </td> </tr> </table> <?php if ($fee_extra_settings) { ?> <div class="extra-settings"> <?php echo $fee_extra_settings;
function wpbdp_categories_list($parent = 0, $hierarchical = true) { $terms = get_categories(array('taxonomy' => WPBDP_CATEGORY_TAX, 'parent' => $parent, 'orderby' => 'name', 'hide_empty' => 0, 'hierarchical' => 0)); if ($hierarchical) { foreach ($terms as &$term) { $term->subcategories = wpbdp_categories_list($term->term_id, true); } } return $terms; }