1. Go to this page and download the library: Download travis/wordpress library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
travis / wordpress example snippets
if (!isset($_GET['json'])) die();
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,
));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.