- You can use Airtable’s view designer to select the exact query you want to display.
This example shows how to filter the list of Artists for only those in the Surrealist genre. This filtering can be done in two ways: in PHP code (more complicated), or by creating a View in Airtable.
Let’s create a new view in Airtable called Surrealists; specify a one-line filter; hide all the fields except Name because we only need that for this example; sort the artist names alphabetically. Hiding fields (database columns) means that much less data will need to be sent to WordPress.
Copy and paste this code into a page or post in WordPress.
The [insert_php] symbols will make the PHP code run on the page.
[insert_php] $query = new AirpressQuery(); $query->setConfig("Artists_DB"); $query->table("Artists")->view("Surrealists"); $data = new AirpressCollection($query); echo "<ul >"; foreach($data as $row){ echo ("<li />"); echo $row["Name"]."<br>"; echo ("</li />"); } echo "</ul >"; [/insert_php]