Post/Code

HomeAboutUsesNow

WordPress + AirPress.

With my recent dive into Airtable, I have been looking into options for using Airtable data for a potential use case. First off, Airtable has an API and a first-party npm package that can be used via Node.js. This makes it really easy to setup a basic Node.js API through which to access data. The thing is, the use case involves WordPress so after looking into the API access topic, I considered whether it might be make more sense to the client to use a WordPress plugin since they already have an existing WordPress website and site maintainer. As such, my thinking is that if I were to stick with the tools they already use and are comfortable, it would make the ongoing maintenance of the site and data easier. Additionally, I would not need to setup a separate Node.js API for a single use-case type of purpose.

A quick Google search lead me to the AirPress plugin by Chester McLaughlin. Helpfully Chester provides a few YouTube videos to get you quickly up to speed on the basics. Straight off the bat, my feeling is that this is not a particularly "user friendly" plugin. What I mean by that is, this is a plugin for a WordPress site-builder or WordPress developer to use in their toolbelt. In order to understand how this plugin works you will need to have some grasp of basic development concepts, shortcodes, Airtable formulas and Regex. For the "casual" user, this plugin might be a little tricky to parse. That being said, if you are comfortable with WordPress parlance, you should find it relatively painless to setup and get going.

That being said, if you are not inclined to watch those videos, here is a quick reference for how to setup the shortcodes in your template page in order to display multiple records in one WordPress page (I suggest you edit your shortcode in "Code Editor" view if you are comfortable with it):

[apr_populate field="id" relatedTo="id"]
    [apr_loop]
        <div class="items">Dates: [apr field="WeekRange"]
        Code: [apr field="WeekCode"]</div>
    [/apr_loop]
  • field="id" means the primary key or primary identifying field for the records in your table. You use that same field in the relatedTo field if you are not referencing other tables. This is a very useful field if you are displaying fields that reference data in other tables since then you can use the value in relatedTo in order to make use of that data.
  • [apr_loop] is a AirPress/shortcode-y way of looping through all the records you want to display. i.e. A for loop.
  • Within the 'loop' you can now access the values within the single records via [apr field="column-name-goes-here"]
  • As you can see, you can also add in typical HTML code in order to hook your CSS styling into.