Airpress is a WordPress plugin that integrates Airtable with WordPress, allowing you to use Airtable data the way you want.
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"]
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 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.
There are two reasons why AirpressCollections should be used even when dealing with just a single AirpressRecord.
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 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"); ?>
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 } ?>
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:
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.
Starting from $0 per month.
Rating
Reviewers
12 reviews
Tags
Developed By
chetmac
Quick & Easy
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 plugins for Wordpress
Galleries plugins for Wordpress
SEO plugins for Wordpress
Contact Form plugins for Wordpress
Forms plugins for Wordpress
Social Feeds plugins for Wordpress
Social Sharing plugins for Wordpress
Events Calendar plugins for Wordpress
Sliders plugins for Wordpress
Analytics plugins for Wordpress
Reviews plugins for Wordpress
Comments plugins for Wordpress
Portfolio plugins for Wordpress
Maps plugins for Wordpress
Security plugins for Wordpress
Translation plugins for Wordpress
Ads plugins for Wordpress
Video Player plugins for Wordpress
Music Player plugins for Wordpress
Backup plugins for Wordpress
Privacy plugins for Wordpress
Optimize plugins for Wordpress
Chat plugins for Wordpress
Countdown plugins for Wordpress
Email Marketing plugins for Wordpress
Tabs plugins for Wordpress
Membership plugins for Wordpress
popup plugins for Wordpress
SiteMap plugins for Wordpress
Payment plugins for Wordpress
Coming Soon plugins for Wordpress
Ecommerce plugins for Wordpress
Customer Support plugins for Wordpress
Inventory plugins for Wordpress
Video Player plugins for Wordpress
Testimonials plugins for Wordpress
Tabs plugins for Wordpress
Social Sharing plugins for Wordpress
Social Feeds plugins for Wordpress
Slider plugins for Wordpress
Reviews plugins for Wordpress
Portfolio plugins for Wordpress
Membership plugins for Wordpress
Forms plugins for Wordpress
Events Calendar plugins for Wordpress
Contact plugins for Wordpress
Comments plugins for Wordpress
Analytics plugins for Wordpress
Common Ninja Apps
Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.
Create Stunning Stories To Engage & Convert Users
Create Custom Product Order Forms Easily
Enhance Design & Draw Attention to Images
Collect and manage donations with a customizable online form.
Create Stunning WordPress Feeds & Improve User Experience
Dynamic pricing displays for enhanced user interactions
Empower Your Website with Accurate and Custom Search
Offer easy visualization & Increase conversions
Capture Interest, Gather Contacts, Boost Website Conversions
Boost Trust and Enhance Credibility to Elevate Sales
Track scrolling with a customizable progress bar or indicator
Add Engaging Elements to Your Videos Easily
More plugins
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!