承接 ak86/wp-auto-post 相关项目开发

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

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

ak86/wp-auto-post

Composer 安装命令:

composer require ak86/wp-auto-post

包简介

A simple PHP library for programatically creating Wordpress posts.

README 文档

README

WP Auto Post Client is a simple API client library written in PHP which allows creating new posts programatically by using Wordpress REST API, without the need to login to the dashboard.

Requirements

  • Nginx/Apache server configured with PHP 7.4 or higher
  • Composer package manager
  • Working installation of Wordpress 5.6 or later with the support for Application Passwords. Follow this link to learn how to obtain an application password. If you can't see the application passwords section at the bottom of your wordpress user profile, you may have to enable it manually.

Installation

composer require ak86/wp-auto-post

Basic Usage

// Require composer autoloader
require_once '/path/to/vendor/autoload.php';

// Import the library
use Ak86\WPAutoPost;

// Set required config vars
$wp_post_endpoint = 'http://yourwordpresssite/wp-json/wp/v2/posts';
$wp_media_endpoint = 'http://yourwordpresssite/wp-json/wp/v2/media';
$wp_auth_username = 'your_wordpress_username';
$wp_auth_password = 'your_wordpress_application_password';

// Initialize the client instance
$wpap_client = new WPAutoPost($wp_post_endpoint, $wp_media_endpoint, $wp_auth_username, $wp_auth_password);

// creating a new post: set post image url 
$imageUrl = 'http://url/to/image.jpg';

// creating a new post: upload the image
$uploaded_image = $wpap_client->upload_image($imageUrl);

// creating a new post: set post data
$postData = array(
    "title" => 'Sample Post Title',
    "content" => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit ...',
    "status" => "publish"
);

// creating a new post: submit post data
$wpap_client->add_wp_post($postData, $uploaded_image->id);

Example App

Please checkout below repository for a functional demo project showing how to use this library.

https://github.com/amilak86/wp-auto-post-demo

License

MIT

Author

Amila Kalansooriya

References

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固