Google APIs

The Google APIs will allow you to display Google Maps on the jobs details pages and geocode the locations to longitude and latitude (a service needed to show the job on a map).
Note this article is updated for use with WPJB 5.9.3, if you are using an older WPJB version please upgrade to the latest one first.

Google API Project

While logged in to Google Accounts, go to https://code.google.com/apis/console/, if you do not have any project created there at the top open dropdown and click “Create Project …“.  Enter some Project Name, and Project ID and click the “Create” button. Once it’s created select your project.
To configure the Google API you will need to enable correct APIs and create API keys that will allow accessing the APIs from your website.

Enable APIs

Next in the left sidebar click on the “Library” menu, on the new page in the top search bar, search and enable the following API services
  • Geocoding API
  • Google Cloud Messaging for Android
  • Google Maps Embed API
  • Google Maps JavaScript API
The easiest way to do this would be to search for each API in the top search box and enable them one by one.

Credentials

Go back to the main project page, then in the right sidebar click the Credentials link.

On the new page press “Create Credentials” and from the menu select “API Key” The key will be automatically created. Repeat this step as you will need two API keys (public and private).

Click on the first API key to edit it, change the name to Public (it’s for informational purposes only), and in the “Set an application restriction” select “Website“. In the “Website Restrictions” panel below, click Add and enter your website URL followed by an asterisk, so for example if your website URL is “https://example.com” enter there “‘https://example.com/*” and press the “Save” button.

Edit the second API key, change the name to Private, in the “Set an application restriction” select “IP Address“, and in the “IP address restrictions” box enter your server IP address. You should be able to find this information in your server control panel (ideally you should set both v4 and v6 IP addresses if available), once ready press the “Save” button.

Enter API Keys

Finally, go to the wp-admin / Settings (WPJB) / Google APIs panel and enter the created API keys there, this will allow you to use maps and geocoding services in WPJB.

Leave a Reply

Your email address will not be published. Required fields are marked *