定制 tatter/wordpress 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tatter/wordpress

Composer 安装命令:

composer require tatter/wordpress

包简介

WordPress content management for CodeIgniter 4

README 文档

README

WordPress content management for CodeIgniter 4

Quick Start

  1. Install with Composer: > composer require tatter/wordpress
  2. Add a new database connection:
	public $wordpress = [
		'DBDriver' => 'Tatter\WordPress\Database',
		'WPConfig' => '/path/to/wp-config.php',
	];

Description

Tatter\WordPress provides a way for you to connect your CodeIgniter 4 instance to an existing WordPress installation.

Usage

This library comes with the Reader class, a parser designed to read configuration values from WordPress' wp-config.php file. By extracting database information and installation path, Tatter\WordPress can connect to the same database and modify information using the supplied models.

Database

In order to use the database you need to define a new database group that uses the connection details provided by Reader. Add a property to app/Config/Database.php with the driver and the path to your wp-config.php file, like this:

class Database extends BaseConfig
{
	public $wordpress = [
		'DBDriver' => 'Tatter\WordPress\Database',
		'WPConfig' => '/path/to/wp-config.php',
	];

Models and Entities

This library defines Models and Entities that correspond to WordPress's database tables. You may use them like ordinary CodeIgniter 4 Models, but pay attention to WordPress's particular database structure. "Meta" tables are handled via a special Entity extension MetaHandler, which allows read/write access to individual meta rows as class properties:

// Get a particular Post
$post = model('Tatter\WordPress\Models\PostModel')->find($postId);

// Access post metadata
echo $post->meta->_wp_page_template; // 'default'

// Update post metadata
$post->meta->_wp_page_template = 'mobile';

Commands

There are a few commands to make it easier to interact with your configuration - these are also a great way to make sure your WordPress database is set up correctly.

  • posts:list - Lists all Posts in a table format
  • posts:show [postId] - Displays details for a single Post
  • posts:delete [postId]... - Deletes one or more Posts by their ID

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固