Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Jolley

    (@mikejolley)

    There is a detailed example https://github.com/mikejolley/WP-Job-Manager/wiki/Editing-Job-Submission-Fields

    If you cannot manage that, I’d recommend getting someone to do it via Codeable or Tweaky.

    Thread Starter kfan21

    (@kfan21)

    Thank you, I had not previously seen those instructions. It is now added to the front end. It is not showing in the admin area.

    Now, I am working on showing the new salary on the content-job_listing.php template. The salary is not showing.

    I added this code to my themes functions.php

    function get_the_job_salary( $post = null ) {
    	$post = get_post( $post );
    
    	if ( $post->post_type !== 'job_listing' )
    		return;
    
    	return apply_filters( 'the_job_salary', $post->_job_salary, $post );
    }

    Then I added this line to show it on the content-job_listing.php

    <li class="date"><?php echo the_job_salary(); ?></li>

    What I am doing wrong that it is not showing? Thank you for your help.

    Plugin Author Mike Jolley

    (@mikejolley)

    Thread Starter kfan21

    (@kfan21)

    I feel like I am so close, but still so far from getting this field to display on my Jobs. Can you hold my hand a little on this one?

    I have changed content-job_listings.php to:

    <li class="date"><?php
    $job_salary_value = get_post_meta( get_the_ID(), 'job_salary', true );
    // check if the custom field has a value
    if( ! empty( $job_salary_value ) ) {
      echo $job_salary_value;
    }
    ?>
     </li>
    Plugin Author Mike Jolley

    (@mikejolley)

    Try $job_salary_value = get_post_meta( get_the_ID(), '_job_salary', true );

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding Custom Salary Field’ is closed to new replies.