2017 © Pedro Peláez
 

library wordpress

A PHP library for working w/ the Wordpress API plugin.

image

travis/wordpress

A PHP library for working w/ the Wordpress API plugin.

  • Saturday, June 27, 2015
  • by car6on
  • Repository
  • 6 Watchers
  • 79 Stars
  • 51 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 21 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Wordpress

A PHP library for working w/ the Wordpress API plugin., (*1)

Install

Normal install via Composer., (*2)

Disable the Public Side of Wordpress

Since you are using the API, you should disable the public side of your Wordpress installation. One way to do that is to open the index.php file in your Wordpress directory and add this code to the top:, (*3)

if (!isset($_GET['json'])) die();

Usage

Send a request by passing an endpoint, controller, method, and params:, (*4)

use Travis\Wordpress;

// set endpoint
$endpoint = 'http://yourwordpress.com/'; // ending slash is important

// get a page
$page = Wordpress::run($endpoint, 'core', 'get_page', [
    'post_type' => 'page',
    'slug' => 'about',
));

// get a post
$post = Wordpress::run($endpoint, 'core', 'get_post', [
    'post_type' => 'post',
    'id' => 100,
));

// get recent posts
$posts = Wordpress::run($endpoint, 'core', 'get_recent_posts', [
    'post_type' => 'post',
    'count' => 10,
    'page' => 1,
));

See the documentation for a full list of available methods., (*5)

The Versions

27/06 2015

dev-master

9999999-dev

A PHP library for working w/ the Wordpress API plugin.

  Sources   Download

MIT

The Requires

 

by Scott Travis

27/06 2015

v1.0.0

1.0.0.0

A PHP library for working w/ the Wordpress API plugin.

  Sources   Download

MIT

The Requires

 

by Scott Travis