• Resolved nicoleomy

    (@nicoleomy)


    Hi!

    I tried to add the Salary field by following the tutorial on this page but the Salary field is not showing up on my front end. Below is my code in my functions.php of my child theme:

    // Adding Theme Support for Custom WP Job Manager page templates
    add_theme_support( 'job-manager-templates' );
    
    // Additional field for WP Job Manager in wp-admin and front-end
    add_filter( 'submit_job_form_fields', 'frontend_add_salary_field' );
    
    function frontend_add_salary_field( $fields ) {
    	  $fields['job']['job_salary'] = array(
    	    'label'       => __( 'Salary (RM)', 'job_manager' ),
    	    'type'        => 'numeric',
    	    'required'    => false,
    	    'placeholder' => 'e.g. 20000',
    	    'priority'    => 13
    	  );
    	  return $fields;
    }
    
    add_filter( 'job_manager_job_listing_data_fields', 'admin_add_salary_field' );
    
    function admin_add_salary_field( $fields ) {
      $fields['_job_salary'] = array(
        'label'       => __( 'Salary (RM)', 'job_manager' ),
        'type'        => 'numeric',
        'placeholder' => 'e.g. 20000',
        'description' => ''
      );
      return $fields;
    }
    
    // Function to display "Salary" on the single job page
    
    add_action( 'single_job_listing_meta_end', 'display_job_salary_data' );
    
    function display_job_salary_data() {
      global $post;
    
      $salary = get_post_meta( $post->ID, '_job_salary', true );
    
      if ( $salary ) {
        echo 'RM ' . esc_html( $salary );
      }
    }

    https://wordpress.org/plugins/wp-job-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter nicoleomy

    (@nicoleomy)

    Changed the type from numeric to text in admin_add_salary_field( $fields ) and it works now:

    function admin_add_salary_field( $fields ) {
      $fields['_job_salary'] = array(
        'label'       => __( 'Salary (RM)', 'job_manager' ),
        'type'        => 'text',
        'placeholder' => 'e.g. 20000',
        'description' => ''
      );
      return $fields;
    }
    Thread Starter nicoleomy

    (@nicoleomy)

    Solved it!

    I have the exact same problem but your fix didn’t work for me.

    The salary field is visible on the job submission form but it doesn’t show on the admin side.

    Here’s my code:

    add_filter( ‘submit_job_form_fields’, ‘frontend_add_salary_field’ );

    function frontend_add_salary_field( $fields ) {
    $fields[‘job’][‘job_salary’] = array(
    ‘label’ => __( ‘Salary ($)’, ‘job_manager’ ),
    ‘type’ => ‘text’,
    ‘required’ => true,
    ‘placeholder’ => ‘e.g. 20000’,
    ‘priority’ => 2
    );
    return $fields;
    }

    add_filter( ‘job_manager_job_listing_data_fields’, ‘admin_add_salary_field’ );

    function admin_add_salary_field( $fields ) {
    $fields[‘_job_salary’] = array(
    ‘label’ => __( ‘Salary ($)’, ‘job_manager’ ),
    ‘type’ => ‘text’,
    ‘placeholder’ => ‘e.g. 20000’,
    ‘description’ => ”
    );
    return $fields;
    }

    Can anyone help please?
    Thanks

    Plugin Contributor Adam Heckler

    (@adamkheckler)

    @phoenixobia: Please create your own thread per the Forum Welcome policy:

    https://codex.wordpress.org/Forum_Welcome#Where_To_Post

    Thanks!

    Thread Starter nicoleomy

    (@nicoleomy)

    @phoenixobia: Do you have WP_DEBUG turned on? Are there any errors?

    Yeah, I think you should set up a new thread as what Adam said, so that it gets the attention of the other members here too 🙂

    Ok, I’ll open a new thread. I just thought it was related to this topic and I wanted to avoid duplication. Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Salary field not showing up in wp-admin Add Jobs page’ is closed to new replies.