Help

Airfields, a Wordpress plugin for managing custom fields in Airtable

9782 17
cancel
Showing results for 
Search instead for 
Did you mean: 

If you run a Wordpress website and you want to be able to easily pull data from Airtable into Wordpress, this is for you.

Airfields is a Wordpress plugin I’ve built that allows data from Airtable to be accessed using Wordpress’ get_post_meta and get_post_custom functions. There is also a shortcode you can use in the post editor that will output the value of whatever Airtable field you specify.

The way it works is that in the Airfields admin settings you will provide (App ID, API Key and) the name of an Airtable table and a field from that table in which either the post slug or the post ID will be stored. Then, any posts that match will have its custom data populated from the fields of the corresponding record from Airtable. This works with pages, posts, and any custom post type and can be used to display any field type Airtable supports.

This should be considered a beta. If you’re a Wordpress plugin developer interested in helping develop this plugin, let me know. And if you’re interested in testing out the plugin, go for it and let me know what changes you’d like to see.

https://github.com/chetmac/airfields/

Here’s what editing a page using shortcodes looks like:
9833d5f1102943f62d6c2e06b909a844ee77e262.png

Here’s the output on the website:
38322647b7fbadd1df06b788ae47052ff30c2a44.png

Here’s the Base it pulls from:
Pasted image

Here’s a code sample of how to use Airfields inside a PHP template file (the Airtable field as actually named, ‘Attachement’):

<?php
$attachment = get_post_meta($post->ID,"Attachment");
echo "<img src='".$attachment[0]["thumbnails"]["large"]["url"]."'>";
?>
17 Replies 17

Great, will do. Thanks Chester.

John_Beaudoin
7 - App Architect
7 - App Architect

Chester,

Thanks for sharing this! It might be really helpful to a project I’m working on. I have three questions for you:
[1] Is there any way to get the plugin to return multiple values from the lookup field – or is this what you meant when you said the biggest challenge was “displaying multiple linked records easily”? Right now, it only seems to return the first value of the lookup field.
[2] Do you know of a way (in Wordpress) to automate the appending of the “?fresh-true” to each post (for instance, it doesn’t appear you can add it to the post’s permalink through the standard editing UI)?
[3] Is there any way to make the plug-in case insensitive when matching the post name to the Airtable record identifier? My WP page slug is all lower case (e.g. john or susan), but the Airtable record is upper case. If not, I can transform the record in Airtable to all lower case, so it’s not a big deal…
Thanks again. Very promising work!

Good news and bad news :slightly_smiling_face:

I’m completely rebuilding Airfields to accommodate all these, the bad news is that I’m in the middle of it so it’s not done.

I will definitely post here when it’s ready.

I’m happy to say that I’ve just posted the completely rebuilt Airpress to GitHub. The plugin used to be called Airfields but I have grander aspirations for the plugin now, so I needed a grander name. The goal is to be able to augment every aspect of Wordpress using Airtable data—hence Airpress.

Currently, posts/pages can automatically fetch corresponding Airtable records. Or “virtual” posts/pages can be created from corresponding Airtable records. And related records can easily be fetched.

I debated whether or not I should release it as beta with incomplete documentation, however I could spend another three months tweaking and improving things and I’d love to get some real-world feedback (other than from my own real-world use) and ideally find some developers willing to contribute to the project.

Russell_Myers
4 - Data Explorer
4 - Data Explorer

Any way to update a field within Airtable from a front-end form (html/PHP cURL via the API or this plugin) at the moment?

Yes. It absolutely possible, I’m doing it on a couple of client websites. However, it’s a fairly custom process depending on what you want to update and how validation needs to be carried out.

What exactly are you trying to accomplish?

One solution I’ve used in the past is to embed a form from a form provider with webhooks (Jotform or Wufoo come to mind) and I use the webhook to update Airtable. The benefit of this is having a pro form with solid validation—and all your results are still stored with the form provider as a backup.

Hay Chester, thanks for the reply.

Actually, I think moving away from Airtable and to a mySQL DB is probably the way forward for this particular case. I have a WP site which I would like to have logged in users update tables of info. Obviously this can be achieved with HTML forms and PHP to the DB but I thought perhaps Airtable and it’s API might be quicker.

Actually, I realise this isn’t what Airtable is designed for and thus probably not right for my use.

Right now, I have a form (from Airtable) embedded in a WP page. This works just fine and people can create entries in the DB. At some later point, fields within that data will need to be changed by front end users and so planned to create a front end html form to collect the data to be changed and use PHP cURL to update the Airtables through the API.

I got this working as far as fetching data and adding new records (neither of which I want to do really!) but updating an existing record using the patch method eludes me for now.

Appreciate the reply though.

Yup, totally agree with your assessment. As great as the API is, I’ve found that Airtable’s strength still lies in it’s user interface. And any projects that use Airtable, but don’t depend on the UI for some critical aspect are much better served with a local data storage solution.