承接 travis/wordpress 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

travis/wordpress

最新稳定版本:1.1.0

Composer 安装命令:

composer require travis/wordpress

包简介

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

README 文档

README

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

Install

Normal install via Composer.

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:

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

Usage

Send a request by passing an endpoint, controller, method, and params:

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.

统计信息

  • 总下载量: 1.61k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 77
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 77
  • Watchers: 5
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-20