Title: Add select box field
Last modified: August 22, 2016

---

# Add select box field

 *  Resolved [hamergil](https://wordpress.org/support/users/hamergil/)
 * (@hamergil)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/add-select-box-field/)
 * Hi All
    I wanted to add a special field to the form submission page (and the 
   admin) called: location. A drop down menu where a user can select location. I
   came across this tutorial: [https://wpjobmanager.com/document/tutorial-adding-a-salary-field-for-jobs/](https://wpjobmanager.com/document/tutorial-adding-a-salary-field-for-jobs/)
   but it is about adding tect field and I need select box + options of course. 
   anyone knows how to do it?
 * Thanks
 * [https://wordpress.org/plugins/wp-job-manager/](https://wordpress.org/plugins/wp-job-manager/)

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660148)
 * You can base it on that tutorial, but you a field type of ‘select’ and pass in
   an array of options. e.g.
 *     ```
       'type' => 'select',
       'options' => array( 'Location 1', 'Location 2' ),
       ```
   
 *  Thread Starter [hamergil](https://wordpress.org/support/users/hamergil/)
 * (@hamergil)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660200)
 * Great! it is working
    Is this the only way to add / edit fields? is there an 
   additional plugin that does that easier? Thanks
 *  [Don](https://wordpress.org/support/users/avilanx/)
 * (@avilanx)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660222)
 * hamergil,
 * I’m not sure if it covers your needs but you may find the plugin [Predefined Regions by Astoundify of use](https://wordpress.org/plugins/wp-job-manager-locations/)(
   it’s free).
 * It essentially adds a new submenu within WP Job Manager wherein you can add multiple
   regions. They then become available for selection on all job related pages.
 * In addition, and if i remember correctly, a toggle option is added to the WP 
   Job Manager settings page, which allows you to use a dropdown select box in your
   filters instead of a text input (which is the default type for the location filter).
 * Hope it is of use to you,
    Don
 *  Thread Starter [hamergil](https://wordpress.org/support/users/hamergil/)
 * (@hamergil)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660227)
 * Thanks Don
    I’ll definitly check that out
 *  [bryceadams](https://wordpress.org/support/users/bryceadams/)
 * (@bryceadams)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660304)
 * [@hamergil](https://wordpress.org/support/users/hamergil/) you may be interested
   in something like this if you don’t want to write any code – [https://plugins.smyl.es/wp-job-manager-field-editor/?in=1](https://plugins.smyl.es/wp-job-manager-field-editor/?in=1)
 * Also, it’d be really great if you’d consider leaving a review too – [https://wordpress.org/support/view/plugin-reviews/wp-job-manager#postform](https://wordpress.org/support/view/plugin-reviews/wp-job-manager#postform)
   🙂
 *  Thread Starter [hamergil](https://wordpress.org/support/users/hamergil/)
 * (@hamergil)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660312)
 * Hey [@bryceadams](https://wordpress.org/support/users/bryceadams/)
    thanks for
   the link. I actually used the above code mike provided but I will definitely 
   consider using this plugin in the future. I left a review in the link you provided
   Thanks.
 *  [dinesh.choithani](https://wordpress.org/support/users/dineshchoithani/)
 * (@dineshchoithani)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660420)
 * Hey [@hamergil](https://wordpress.org/support/users/hamergil/)
    Can you please
   tell whether you hard coded the locations in that code ?
 * I sort of need to show in the drop down only the locations that exist in the 
   jobs added.
 * Thanks in advance !
 *  Thread Starter [hamergil](https://wordpress.org/support/users/hamergil/)
 * (@hamergil)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660422)
 * Sure. this is the code I was using:
 *     ```
       add_filter( 'submit_job_form_fields', 'frontend_add_region_field' );
   
       function frontend_add_region_field( $fields ) {
         $fields['job']['job_region'] = array(
           'label' => __( 'Region', 'job_manager' ),
           'type' => 'select',
           'options' => array( 'East', 'West','South', 'North'),
           'required' => true,
           'placeholder' => '',
           'priority' => 3
         );
         return $fields;
       }
       add_action( 'job_manager_update_job_data', 'frontend_add_region_field_save', 10, 2 );
       function frontend_add_region_field_save( $job_id, $values ) {
         update_post_meta( $job_id, '_job_region', $values['job']['job_region'] );
       }
       ```
   
 * This added a special “Region” drop down field to my frint end “add job” page.
   
   hope it helps
 *  [dallashuggins](https://wordpress.org/support/users/dallashuggins/)
 * (@dallashuggins)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660542)
 * After creating the drop down menu (great tutorial [here](http://code.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-1-intro-and-basic-fields--wp-23259)
   for those who are interested) – does anyone know how to call values to the front
   end of wordpress based on the option selected in the select box? I’m not looking
   to add the dropdown to the front end, I just wanted to call text specific to 
   each option.
 * Been trying variations of the code below and it’s not working:
 *     ```
       <?php // adds custom dropdown field to frontend
       $dropdown_values = get_post_meta( $post->ID, 'dropdown_select', true) ;
       $dropdown_ai_value = $field['id'];
       if( ! empty( $dropdown_values ) ) {
         echo $dropdown_ai_value;
       }
       ?>
       ```
   
 * I’ve used the below code to pull in text values and it’s worked perfectly – how
   do you edit the code to be select box specific?
 *     ```
       <div class="mymetavaluekey1" style="font: Helvetica, Arial, sans-serif font-size: 18px font-style: italic text-align: center;">
       <?php  // adds custom title field to frontend
       $meta_values = get_post_meta( get_the_ID(), '_my_meta_value_key', true) ;
       if( ! empty( $meta_values ) ) {
         echo $meta_values;
       }
       ?>
       </div>
       ```
   
 *  [wesbot](https://wordpress.org/support/users/wesbot/)
 * (@wesbot)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660544)
 * Hey dallashuggins.
 * I used Advanced Custom Fields plugin to create fields easily then passed this
   to WP job manager template files.
 * For example, I added a whole bunch of text fields so the job description could
   have subheadings using this plugin which is very easy to do. Then I assigned 
   them to the job_listing post type so they only appeared when editing a job post
   type and not a generic post or page.
 * Then in my WP job manager template files I added:
 *     ```
       $fields = get_field_objects();
   
       		if( $fields )
       		{
       			foreach( $fields as $field_name => $field )
       			{
       				echo '<div>';
       					echo '<h4>' . $field['label'] . '</h4>';
       					echo $field['value'];
       				echo '</div>';
       			}
       		}
       ```
   
 * This will grab the fields, and if content exists for that field, outputs the 
   result.
 * I hope you find this easier than editing core functions.php files. I sure as 
   hell did.
 *  [danny_wobble](https://wordpress.org/support/users/danny_wobble/)
 * (@danny_wobble)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660545)
 * Hi Mike Jolley,
 * I’ve included the following to my custom job listing data field in my functions.
   php.
 * ‘type’ => ‘select’,
    ‘options’ => array( ‘Location 1’, ‘Location 2’ ),
 * So it now looks like this:
 * add_filter( ‘job_manager_job_listing_data_fields’, ‘admin_add_nhs_grade_field’);
 * function admin_add_nhs_grade_field( $fields ) {
    $fields[‘_nhs_grade’] = array(‘
   label’ => __( ‘NHS Grade’, ‘job_manager’ ), ‘type’ => ‘select’, ‘options’ => 
   array( ‘HCPC Paramedics’, ‘IHCD Technicians’ ,’HCPC Paramedics with CP Qualification’),‘
   placeholder’ => ‘IHCD FPOS or Equivalent’, ‘description’ => ” ); return $fields;
 * }
 * However all thats getting saved in the database is numbers (0’s, 1’s, 2’s) they
   all relate to which option I chose in the job listing within the CMS. But no 
   actual value is being saved. Such as ‘HCPC Paramedics’ or ‘IHCD Technicians’.
 * Do you know why?
 * Thanks,
 * Daniel.
 *  Plugin Author [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660546)
 * danny_wobble set the key and value in your array of options. `array( 'HCPC Paramedics'
   => 'HCPC Paramedics' )`

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Add select box field’ is closed to new replies.

 * ![](https://ps.w.org/wp-job-manager/assets/icon-256x256.gif?rev=2975257)
 * [WP Job Manager](https://wordpress.org/plugins/wp-job-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-job-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-job-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-job-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-job-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-job-manager/reviews/)

## Tags

 * [box](https://wordpress.org/support/topic-tag/box/)
 * [drop-down](https://wordpress.org/support/topic-tag/drop-down/)
 * [field](https://wordpress.org/support/topic-tag/field/)
 * [select](https://wordpress.org/support/topic-tag/select/)

 * 12 replies
 * 8 participants
 * Last reply from: [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/add-select-box-field/#post-5660546)
 * Status: resolved