• Resolved Matt Peskett

    (@djmathu)


    Hello,

    I’m following the instructions here https://wpjobmanager.com/document/tutorial-adding-a-salary-field-for-jobs/ but the final ‘Adding a Salary Filter to the Job Search Form’ doesn’t work as a filter hook in into functions.php, the other two are OK and look good. Is this because my WP Job Manager version is higher than 1.23.6 (it’s 1.23.9) or does that only refer to lower variants?

    I also tried pasting the other field option into job-filters.php but that just renders the results empty.

    Need some help please, ideally I want salary as a drop down filter and if possible salary displayed as a column in the results beneath. Be really great if there was a paid upgrade for this – then I would have got it with my add on package purchase!

    Thanks

    Matt

    https://www.ads-software.com/plugins/wp-job-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Matt Peskett

    (@djmathu)

    OK I’ve created a partial solution of sorts to display salary inside WP Job Manager results (but still no joy with a drop down filter).

    For the simple salary display bit just replicate the hook and function of displaying salary in a single post (as per the tutorial), but rename the Meta and increment the function so as not to cause a conflict. Adds salary beneath the job type and days posted values which works for me:

    /*
     *  add salary field to WP Job Manager post listings
     */
    
    add_action( 'job_listing_meta_end', 'display_job_salary_data2' );</p>
    <p>function display_job_salary_data2() {<br />
      global $post;</p>
    <p>  $salary = get_post_meta( $post->ID, '_job_salary', true );</p>
    <p>  if ( $salary ) {<br />
        echo '</p>
    <li>' . __( 'Salary:' ) . ' ?£' . esc_html( $salary ) . '</li>
    <p>';<br />
      }<br />
    }<br />

    Plugin Contributor Adam Heckler

    (@adamkheckler)

    The code should work fine on versions of Job Manager beyond 1.23.6. When I add the code here:

    https://wpjobmanager.com/document/tutorial-adding-a-salary-field-for-jobs/#section-4

    … to my theme’s functions.php file, it seems to work just fine:

    https://d.pr/i/12wgU/4mZ45tUg

    Try downloading it as a standalone plugin and installing it:

    https://gist.github.com/34981632c054ed53b73a

    Just remove the similar code from your functions.php first if you try that.

    Thread Starter Matt Peskett

    (@djmathu)

    Thanks Adam, this plug-in worked just great – the drop down has appeared, a minor amend of $ to £ and it’s good for the UK ??

    Thread Starter Matt Peskett

    (@djmathu)

    We’ll mark this closed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Salary field filter hook-in doesn't display’ is closed to new replies.