Editing Company Submission Fields

Note: All code examples on this site are provided for developer reference/guidance only and we cannot guarantee that they will always work as expected. Our support policy does not include assistance with modifying or debugging code from any code examples, and they may be changed or removed if we find they no longer work due to changes in our plugins.

There are two main ways to customize the fields in Company Listings for WP Job Manager;

  1. For simple text changes, using a localization file or a plugin such as the Say What Plugin. See Translating Company Listings WP Job Manager for more information.

  2. Use the WordPress hooks (filters) which are explained below.

Company Listings for WP Job Manager’s approach to allowing customization of its forms is to use filters. In WordPress, filters essentially allow you to ‘filter’ data through your own custom PHP functions which return a different ‘filtered’ result. Any custom code can go in your theme functions.php file.

Editing fields on the frontend

Editing job submission fields is possible via the submit_company_form_fields filter. Adding some code will allow you to edit various fields, or add new ones.

See the below example which demonstrates how to change a field’s label:

1 2 3 4 5 6 7 8 9 10 11 12 13 // Add your own function to filter the fields add_filter( 'submit_company_form_fields', 'custom_submit_company_form_fields' ); // This is your function which takes the fields, modifies them, and returns them // You can see the fields which can be changed here: your-website.com/wp-content/plugins/wp-job-manager-company-listings/includes/forms/class-wp-job-manager-company-listings-form-submit-company.php function custom_submit_company_form_fields( $fields ) { // Here we target one of the job fields (company_name) and change it's label $fields['company_fields']['company_name']['label'] = "Custom Label"; // And return the modified fields return $fields; }

 

Editing fields in admin

Fields in admin are of similar structure and can be edited using the ‘company_listings_company_fields’ filter. Each field takes a label, placeholder, type, and description arguments.

See the below example which demonstrates how to change a field’s placeholder:

1 2 3 4 5 6 7 8 9 10 11 12 13 // Add your own function to filter the fields add_filter( 'company_listings_company_fields', 'custom_company_listings_company_fields' ); // This is your function which takes the fields, modifies them, and returns them // You can see the fields which can be changed here: your-website.com/wp-content/plugins/wp-job-manager-company-listings/includes/admin/class-wp-job-manager-writepanels.php function custom_company_listings_company_fields( $fields ) { // Here we target one of the job fields (location) and change it's placeholder $fields['_company_website']['placeholder'] = "Custom placeholder"; // And return the modified fields return $fields; }

Seeing the code in action

See the following tutorial to see this code used: Tutorial: Adding a new field for submitting the company.