Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter kivo7

    (@kivo7)

    Hi, Davor

    Actually I read your tutorial several times and even made some fields with succes. But there were textarea fields, not selectboxes.

    My full code is:

    //** Add field "job_experience" to the frontend
    add_filter( 'submit_job_form_fields', 'frontend_add_experience_field' );
    function frontend_add_experience_field( $fields ) {
      $fields['job']['job_experience'] = array(
        'label'       => __( 'Experience' ),
        'type'        => 'select',
        'required'    => false,
        'priority'    => 8,
        'options' => array(
                           'option1' => 'no experience',  // 'value'=>'label'
                           'option2' => '1 year',
                           'option3' => '2 years',
                           'option4' => '5 years' )
      );
     
      return $fields;
    }
    
    //** Add field "job_experience" to admin
    add_filter( 'job_manager_job_listing_data_fields', 'admin_add_experience_field' );
    function admin_add_experience_field( $fields ) {
      $fields['_job_experience'] = array(
        'label'       => __( 'Experience' ),
        'type'        => 'select',
        'required'    => false,
        'priority'    => 8,
        'options' => array(
                           'option1' => 'no experience',  // 'value'=>'label'
                           'option2' => '1 year',
                           'option3' => '2 years',
                           'option4' => '5 years' )
      );
      return $fields;
    }
    
    //** Display "job_experience" on the single job page
    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>';
      }
    }

    Please let me know how to display the label of my filed on the single job page. Now I have only the value: https://prntscr.com/ggx9a2 . But I need to display not “option1”, but “no experience”.

    How can I add a space between the price and currency symbol. It is no space by default so it looks not well.
    100,000руб

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