[Plugin: WP Job Manager] Custom fields in job listing
-
Hi there,
I’m using a plugin called WP Job Manager to let users post jobs to a website. There’s quite good documention how to edit the “Job Submission Form” @ https://github.com/mikejolley/WP-Job-Manager/wiki.
In the functions i’ve tested it by adding a salary field: https://github.com/mikejolley/WP-Job-Manager/wiki/Editing-Job-Submission-Fields
That all goes well, but I’m wondering how I could make that custom field show up in the “Job Listings” I know that the function has to be added somehow in the “content-job_listing.php somehow.
This is my functions.php
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' => '', 'priority' => 7 ); return $fields; } add_action( 'job_manager_update_job_data', 'frontend_add_salary_field_save', 10, 2 ); function frontend_add_salary_field_save( $job_id, $values ) { update_post_meta( $job_id, '_job_salary', $values['job']['job_salary'] ); } 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' => '', 'description' => '' ); return $fields; }
And that function should be posted here:
<li <?php job_listing_class(); ?>> <a href="<?php the_job_permalink(); ?>"> <?php the_company_logo(); ?> <div class="position"> <h3><?php the_title(); ?></h3> <div class="company"> <?php the_company_name( '<strong>', '</strong> ' ); ?> <?php the_company_tagline( '<span class="tagline">', '</span>' ); ?> </div> </div> <div class="location"> <?php the_job_location( false ); ?> </div> <ul class="meta"> <li class="job-type <?php echo get_the_job_type() ? sanitize_title( get_the_job_type()->slug ) : ''; ?>"><?php the_job_type(); ?></li> <li class="date"><date><?php printf( __( 'Posted %s ago', 'job_manager' ), human_time_diff( get_post_time( 'U' ), current_time( 'timestamp' ) ) ); ?></date></li> </ul> </a> </li>
Thanks in advance 🙂
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘[Plugin: WP Job Manager] Custom fields in job listing’ is closed to new replies.