Adding extra fields to WPJM
-
Hi,
I am trying to show the new filed ‘job_experience’ which I have created via your tutorial. But it is not text value but array.
add_filter( 'job_manager_job_listing_data_fields', 'admin_add_experience_field' ); function admin_add_experience_field( $fields ) { $fields['_job_exprience'] = array( 'label' => __( 'Опыт', 'job_manager' ), 'type' => 'select', 'required' => false, 'priority' => 8, 'options' => array( 'option[1]' => 'no experience', // 'value'=>'label' 'option[2]' => '1 year', 'option[3]' => '2 year', 'option[4]' => '3 year' ) ); return $fields; }
To show on the job page I use this code:
add_action( 'single_job_listing_meta_end', 'display_job_experience_data' ); function display_job_experience_data() { global $post; $experience = get_post_meta( $post->ID, '_job_experience', true ); if ( $experience ) { echo '<li>' . __( 'Experience: ' ) . esc_html( $experience ) . '</li>'; } }
But it returns only key of array like ‘option[1]’, not a value ‘no experience’. What should I change in code to solve this problem?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Adding extra fields to WPJM’ is closed to new replies.