Airpress

Airpress

Wordpress plugin

Install on Wordpress

App Details

Airpress is a WordPress plugin that integrates Airtable with WordPress, allowing you to use Airtable data the way you want.

Features

  • Shortcodes for displaying, formating, and looping through fields
  • Robust ORM-like PHP methods for advanced queries and coding
  • Filters and actions for easily customizing field output
  • Advanced caching with asynchronous background refresh
  • Automaticly fetch Airtable records based on URL or Post Type
  • Easily create completely “virtual” or runtime posts/pages
  • Populate/fetch related records (and filter, sort, limit)
  • Access records from multiple Airtable bases
  • Use multiple Airtable API Keys

Basic Usage

Automatic Airtable Requests

Airpress comes with two built-in extensions—Virtual Fields and Virtual Posts—both of which are used to map certain WordPress objects or URLs to Airtable records (one to one or one to many or many to many). Records that are automatically requested are stored in the variable $post->AirpressCollection

<?php $e = $post->AirpressCollection[0]; echo $e["Name"].": ".$e["Start Date"]."<br>"; ?> 

or you can use the shortcode wherever shortcodes are allowed:

[apr field="Name"]: [apr field="Start Date"] 

Manual Airtable Requests

Airpress can be used to manually request records from Airtable by specifying the desired table, view, filter, sort, etc.

<?php $query = new AirpressQuery(); $query->setConfig("default"); $query->table("Events")->view("Upcoming"); $query->addFilter("{Status}='Enabled'"); $events = new AirpressCollection($query); foreach($events as $e){ echo $e["Name"].": ".$e["Start Date"]."<br>"; } ?> 

Both manual and automatic requests can be configured and used entirely within the WordPress admin dashboard or entirely via PHP code.

Related Records

Related records may easily be retrieved both in PHP code and via shortcodes. When a related/linked field is “populated”, the linked records actually replace the corresponding RECORD_ID().

Consider a base with two related tables: Events and Locations, if you populate the “Events” field of the Locations collection, it goes from being an array of RECORD_ID()s to an AirpressCollection with AirpressRecords.

[apr_populate field="Location" relatedTo="Locations"] [apr_populate field="Location|Owner" relatedTo="Contacts"] [apr name="Name"] at [airfield name="Location|Name"] owned by [airfield name="Location|Owner|Name"] <?php $events = $post->AirpressCollection(); $linked_field = "Location"; $linked_table = "Locations"; $events->populateRelatedField($linked_field, $linked_table); // You can even populate linked fields of linked fields! $events->populateRelatedField("Location|Owner", "Contacts"); echo $events[0]["Name"]." at "; echo $events[0]["Location"][0]["Name"]." owned by"; echo $events[0]["Location"][0]["Owner"][0]["Name"]."<br>"; ?> 

You may also specify a complete query with which to retrieve the linked records. For example, if you want to find all upcoming Events for a particular Location:

// default is the name of the Airtable Connection configuration $query = new AirpressQuery("Locations", "default"); $query->filterByFormula("{Name}='My Local Pub'"); $locations = new AirpressCollection($query); $query = new AirpressQuery("Events", "default"); $query->filterByFormula("IS_BEFORE( TODAY(), {Start Date} )"); $locations->populateRelatedField("Events", $query); 

This will update each record in the $locations collection with associated events that are after TODAY(). Any other linked events will be removed—NOT from the Airtable record, just from the $locations collection.

Airpress Collections and Records

There are two reasons why AirpressCollections should be used even when dealing with just a single AirpressRecord.

  1. All Airtable linked fields are arrays, regardless of it you uncheck ‘Allow Linking to Multiple Records’. And until the Airtable Metadata API is available there’s no way to know if your linked record might contain more than one record.
  2. Airpress allows you to automatically (or manually) retrieve one or more Airtable records. And when you’re dealing with populating related fields for multiple records, Airpress intelligently aggregates ALL the RECORD_ID()s for the same field in all the records, making a single API request, then “collates” the resulting records back into the appropriate “parent” record. Essentially, Airpress does everything it can do to minimize the number of API requests. Dealing with just a single record would mean many many more API requests.

Both AirpressCollection() and AirpressRecord() are PHP ArrayObjects. This means that they behave like arrays even though they can store custom properties and methods as well. So for an AirpressRecord $r[“Field Name”] and $r->record_id() both work! This allows easy foreach iteration through records and fields while allowing custom methods as well.

Airpress needs better documentation regarding how it “implodes” fields from multiple records when using the shortcodes and AirpressCollection methods.

Airtable Connections

Airtable Connections store your API credentials and allow Airpress to “talk” to the Airtable API. You’ll need to enter your API KEY and APP ID.

Multiple connections to the same base can be used if you want different multiple caching or logging settings. For example, you may have a single base but you want all requests made to the Events table to be refreshed every 5 minutes, however any requests made to the Locations table only need to be refreshed daily.

The name you give the connection is how you’ll refer to this Connection from other settings pages and in any PHP code you write. (You can also refer to the first connection configuration numerically using a zero-based index).

<?php $query = new AirpressQuery(); $query->setConfig("default"); $query->table("My Airtable table name"); ?> 

Error Handling

Since version 1.1.46 the AirpressQuery has the hasErrors() and getErrors() methods that should be used when doing any syncing operations as Airtable doesn’t have a perfect ‘uptime’ record and you don’t want to sync empty results just because your request either timed out or return a 422 error or something.

<?php $query = new AirpressQuery("My Table Name",0); $records = new AirpressCollection($query); if ( $query->hasErrors() ){ print_r($query->getErrors()); print_r($query->toString()); // or $code = $errors[0]["code"]; $message = $errors[0]["message"]; $string = $query->toString(); } else if ( is_airpress_empty($records) ) { // Query was fine, just returned no results } else { // Do something with $records } ?> 

Caching

The Airpress cache saves the results of each Airtable API request using a hash of the request parameters. Each subsequent identical request will be served from the local database.

When a cached request is no longer considered “fresh”, the cached result will be served one last time while the cache is updated asynchronously in the background so as not to slow the page load.

If a cached request has expired completely, then the page load will wait for “fresh” data to be requested.

Airpress gives you control over what is considered “fresh” and “expired” data via these two variables:

Refresh: The number of seconds after which Airpress will perform a background refresh on a cached Airtable API request.

Expire: The number of seconds after which Airpress will no longer serve the cached request.

Query var to force refresh: During development (and even while in production) it can be extremely helpful to force Airpress to load all requests directly from Airpress. Hosts like GoDaddy and MediaTemple already provide a query var to flush the cache, so if you set Airpress’ force refresh to the same var, you can flush everything at once.

Assuming “Refresh” is set for five minutes and “Expire” is set for an hour:

  1. Visitor loads a page triggering a request at 8:00am. No cache exists, so data is fetched in real-time, significantly slowing the loading of the page.
  2. Visitor reloads the page at 8:04am, so data is fetched from the cache.
  3. Visitor reloads the page at 8:06am (1 minute past the refresh time), so data is loaded from the cache while an asynchronous background request is made to refresh the cache. Page load is NOT affected.
  4. Visitor reloads the page at 9:07am (1 minute past the exire time—remember the data was last refreshed at 8:06am), so the data is fetched from Airtable in real-time, significantly slowing the loading of the page.

Airpress plays nicely with object caches and page caches. Please note that some hosts aggressively purge the transient cache (which is where cached requests are stored) resulting in more requests than might be expected. Also, if you have a page cache that bypasses PHP and directly serves cached HTML, then obviously Airpress won’t be able to check the “freshness” of the data until the cached page is regenerated.

Shortcodes

  • apr_populate
  • apr
  • apr_include
  • apr_loop
  • apr_loop_0..10

filters

  • airpress_configs ($configs array, option group “airpress_cx, airpress_vf, airpress_vp//
  • airpress_include_path_pre ($include)
  • airpress_include_path
  • airpress_shortcode_filter_{date}
  • airpress_shortcode_filter
  • airpress_virtualpost_query
  • airpress_virtualpost_last_chance

Actions

  • airpress_virtualpost_setup

Functions

  • airpress_debug
  • is_airpress_force_fresh
  • get_airpress_configs
  • is_airpress_record
  • is_airpress_empty
  • is_airpress_collection

Pricing

Starting from $0 per month.

Check Out the Corner Coupon Pop-up Widget

By Common Ninja

Corner Coupon Pop-upTry For Free!

App Info

Rating

Reviewers

12 reviews

Tags

Airtable
custom
custom field
data management
repeater

Developed By

chetmac

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Corner Coupon Pop-up for Wordpress logo

Corner Coupon Pop-up

Add a corner coupon pop-up to highlight discounts, collect emails, and drive user engagement without interrupting browsing.

Image Stack Gallery for Wordpress logo

Image Stack Gallery

Showcase photos with an image stack gallery that layers images in a stacked display with smooth transitions to create a visually striking presentation.

Image Accordion for Wordpress logo

Image Accordion

Use an image accordion to show pictures in collapsible panels that save space, highlight key visuals, and keep visitors engaged.

Restaurant Menu List for Wordpress logo

Restaurant Menu List

Create a clear restaurant menu list that helps visitors explore dishes easily, understand key details, and make confident ordering decisions that support conversions.

Team Members Blobs for Wordpress logo

Team Members Blobs

Use team members blobs to present your staff in a clear, creative format that builds trust, supports transparency, and strengthens brand credibility.

Pricing Slider for Wordpress logo

Pricing Slider

Use a pricing slider to show dynamic prices by quantity, help visitors compare options, and support confident purchases.

PDF Flipbook for Wordpress logo

PDF Flipbook

Transform PDFs into interactive flipbooks with a PDF flipbook widget that improves reading and keeps visitors engaged.

Cookies Consent Bar for Wordpress logo

Cookies Consent Bar

Display a cookies consent bar that explains usage and supports GDPR compliance, enhancing user trust and legal clarity.

MP3 Player for Wordpress logo

MP3 Player

Add an MP3 Player to your website and engage visitors with music, podcasts, and spoken audio without any setup complexity.

Payment Button for Wordpress logo

Payment Button

Use a payment button for secure PayPal or Stripe checkout to simplify online payments and help increase sales.

Before & After Slider for Wordpress logo

Before & After Slider

Add an interactive before and after slider to your site to show visual transformations, capture attention, and help visitors understand real results.

Animated Headline for Wordpress logo

Animated Headline

Add animated headlines to draw attention to key messages and improve user engagement through visual emphasis.

More plugins

plugins You Might Like

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms