WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Select with wp_dropdown_categories (1 post)

  1. jeezyo
    Member
    Posted 2 years ago #

    Im going crazy trying to figure this out, so im hoping somebody has some input! I am using a theme that uses the following code (all i added is the "chzn-select" classes) to generate a select dropdown field.

    <p class="<?php if (get_option('jr_submit_cat_required')!=='yes') : echo 'optional'; endif; ?>"><label for="job_cat"><?php _e('Job Category', 'appthemes'); ?> <?php if (get_option('jr_submit_cat_required')=='yes') : ?><span title="required">*</span><?php endif; ?></label> <?php
    				$sel = 0;
    				if (isset($posted['job_term_cat']) && $posted['job_term_cat']>0) $sel = $posted['job_term_cat'];
    				global $featured_job_cat_id;
    				$args = array(
    				    'orderby'            => 'name',
    				    'exclude'			 => $featured_job_cat_id,
    				    'order'              => 'ASC',
    				    'name'               => 'job_term_cat',
    				    'hierarchical'       => 0,
    				    'echo'				 => 0,
    				    'class'              => 'chzn-select',
    				    'selected'			 => $sel,
    				    'taxonomy'			 => 'job_cat',
    				    'hide_empty'		 => false
    				);
    				$dropdown = wp_dropdown_categories( $args);
    				$dropdown = str_replace( 'class=\'job_cat\' \'chzn-select\'>', 'class=\'job_cat\' \'chzn-select\'><option value="">'.__('Select a category&hellip;', 'appthemes').'</option>',$dropdown);
    				echo $dropdown;
    			?></p>

    I was to use it as a multiple select. i have try every way i can imagine entering it in the str_replace, with no luck. I know this cant possibly be as difficult as im making it, id really appreciate any help :-)

Topic Closed

This topic has been closed to new replies.

About this Topic