定制 symbiote/silverstripe-wordpressmigrationtools 二次开发

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

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

symbiote/silverstripe-wordpressmigrationtools

Composer 安装命令:

composer require symbiote/silverstripe-wordpressmigrationtools

包简介

A wordpress importer that handles various operations.

README 文档

README

A Wordpress Importer that handles various operations:

  • Import Pages (WordpressImportService::importPages)
  • Update imported pages to have same Wordpress page hierarchy (WordpressImportService::updatePagesBasedOnHierarchy)
  • Fix $Content or Elemental's ElementContent $HTML to point assets to local URLs or shortcodes as appropriate (WordpressImportService::fixPostContentURLs)
  • Update Home page to match Wordpress home page (WordpressImportService::setHomepageToWordpressPageAndDeleteCurrentHomePage)
  • Update imported pages to have match the provided Wordpress menu hierarchy (WordpressImportService::updatePagesBasedOnNavMenu)
  • Import Gravity Forms data as UserDefinedForm pages (WordpressImportService::importGravityForms)

Quick Start

  • Configure WordpressImportBasicTask items in in YML
---
Name: wordpress_import
After:
  - 'framework/*'
  - 'cms/*'
---
WordpressImportBasicTask:
  default_db:
    database: 'my-wordpress-db'
    username: 'root'
    password: ''
    table_prefix: 'wp'
  navigation_slug: 'top-navigation'
  • Run "Wordpress Basic Import Task" from /dev/tasks

Modifying/Extending the importer

This Wordpress importer is designed to allow you to take the functionality you want to use specifically and then easily tack your own logic on top. The simplest way to do this is to create your own task that extends 'WordpressImportBasicTask' and override the 'runCustom' function. From here you can either choose to call 'parent::runCustom()' or copy-paste the seperate import function calls and comment out what you don't need.

<?php
class WordpressTask extends WordpressImportBasicTask {
	public function runCustom($request) {
		/**
		 * Uncomment this or copy-paste the various functions called in the 
		 * parent into this and comment out what you don't need.
		 */
		//parent::runCustom($request);

		try {
			// Overriden to just import a flat list of pages
			$this->wordpressImportService->importPages();
			// ... and fix the content href's/src's
			$this->wordpressImportService->fixPostContentURLs();
		} catch (Exception $e) {
			throw $e;
		}
	}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-09-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固