Wordpress and the Factual API

Alert: We are sun-setting access to the V3 APIs (Read, Schema, Facets, Submit). Learn more.

This page serves to help you access the Factual API from within your own instance of WordPress. You can use Factual’s PHP driver along with WordPress to access Factual data for use with your site.

Getting Started

What you’ll need

You’ll need three things to get started:

  1. An instance of WordPress
  2. The Factual PHP driver
  3. A Factual API Key
Install the driver
  1. Download the zip archive of the driver from Factual or git clone from https://github.com/Factual/factual-php-driver and then zip archive it yourself.
  2. Go to the plugins page of the Wordpress Manager (/wordpress/wp-admin/plugins.php)
  3. Click Add New
  4. Click Upload
  5. Select the .zip archive of the driver (note: the plug-in manager will ONLY accept .zip files)
  6. Click Activate Plugin
  7. Create a test page, something like this:
/** load factual driver. Make sure the path below matches what you have! */
$factual = new Factual("YOUR_API_KEY","YOUR_API_SECRET");
$query = new FactualQuery;
$res = $factual->fetch("places-us", $query);
$data = $res->getData();
<h1>Hello. I found a place at:
/** print the address of the first place */

Assuming everything is configured correctly, your new webpage should look like this:

Hello World Results