1. Home
  2. Developer
  3. Code Snippets
  4. Understanding and Customizing the Job Location

Understanding and Customizing the Job Location

One of the most important data points about your jobs, especially when it comes to its structured data and appearance on external aggregators like Google for Jobs, is the associated location data.

When Matador gets job data from Bullhorn, all location data available is collected. This includes address, city, state or province, zip or postal code, and country. When a job has no location data, Matador will try to get location data from the hiring company data. While many Matador-powered sites won’t show this complete data to the user, it will be available to aggregators like Google’s Google for Jobs bot.

Once the raw location is downloaded, it is saved to the Job’s post meta. Then two things are also done with it: a “job general location” is generated and saved to post meta and the job is assigned to a location taxonomy for use in the drop down searches. These two things can be customized.

Customizing the “Job General Location” Field

The “job general location” is a job meta field that holds a user-friendly compound location string, often formatted by job board operators in the localized address format. The default job information header uses the “job general location” field data.

By default, this is:

[city or locality], [state or prov]

In the event that either of these fields are not set, ie: there is no city/locality, but the other is set, that will be shown.

That said, some localization use cases need more detail, while some need less. Some companies only hire in a small region and may not need state. Others may prefer to replace state with country, for example, an EU-based firm.

You can add a filter to change this value easily:

Customizing the Job Location Taxonomy

In addition to the job general location meta field, you may also want to change what location data point is used to populate the location taxonomy.

A taxonomy is a word that is a lot like category, but more general. In fact, a category is a type of taxonomy. In our case, jobs can get assigned to the category taxonomy and the location taxonomy out of the box. Various Matador Jobs Pro All-Access Extensions also add other taxonomies.

The location taxonomy is irrelevant to your job board data consumed by external aggregators like Google for Jobs, but might be important to your job board site for the purposes of search, filters, or email notifications.

The job is assigned to a location taxonomy based on a default data point from the job data. This default data point is the job’s city, if there is one.

It is very easy to change this using the snippet of code below:

In order to protect, you, our users, from doing something that might break Matador, if you pass a value that is not in the list of allowed fields, we will default to city.

If you are applying this change after your initial sync, it is recommend you remove all location terms from your database and re-sync.

Advanced: Adding and Using A Custom Field In Location Data Points

So what if you want to do something crazy? For example, you want to list all your jobs in an around Phoenix, AZ, USA and its suburbs as “Phoenix”, even if the job is actually in Scottsdale, AZ, then you have a use case for a custom field for location data. Lets figure out how to do that.

This requires use of a filter added in Matador Jobs 3.6.0.

Step 1: Set Up Custom Field in Bullhorn

Using the Bullhorn fields editor in the admin section of your ATS, set up a custom field on JobOrder. You will want to take note of the computer name for the field, ie: customText1.

Step 2: Import the Custom Field During Sync

We will now import the new custom field. In the code example below, a field 'customText1' is imported as 'location_area'. Your field will be whatever you set it to in the previous step in Bullhorn.

Step 3: Save the Custom Data Point

Since general job meta is saved later in the sync process, we’ll need to add make this data available earlier. We can do this using the matador_import_before_save_job_address action.

If you do not plan to modify the “Job General Location” field and/or the Job Location Taxonomy, you can actually skip this and the next step.

Step 4: Using the Custom Data Point

Now that this custom location data point is associated with your job, you can use it like you would any other job field, including with the [matador_field] shortcode, the matador_the_job_meta() and matador_get_the_job_meta() template functions, or the various core WordPress functions to access post type meta.

But if you want to include this custom data point in your “job general location” field and/or as the location taxonomy value, you’ll need to do a little extra work.

Step 4a: Using the Custom Data Point with “Job General Location” Field

To modify the “Job General Location” with your new data point, you must filter the field as shown above, but the custom data point will not be included in the array of options, so you will need to get it separately using WordPress’s get_post_meta function.

Step 4b: Using the Custom Data Point as Location Taxonomy Term

To use the custom location data point as the value for the custom taxonomy, you will need to do two things. First you will need to whitelist the field. To protect you from breaking your site, you may only use one of a few allowed fields, and if you don’t use one of them, the city will be used. So we must whitelist the field and then set the taxonomy source to that field as we would do normally.

Updated on September 25, 2023

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support