silverstripe-module silverstripe-wordpressmigrationtools
A wordpress importer that handles various operations.
silbinarywolf/silverstripe-wordpressmigrationtools
A wordpress importer that handles various operations.
- Thursday, October 13, 2016
- by SilbinaryWolf
- Repository
- 1 Watchers
- 0 Stars
- 693 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 3 Versions
- 0 % Grown
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), (*1)
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., (*2)
<?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;
}
}
dev-master
9999999-dev
A wordpress importer that handles various operations.
Sources
Download
BSD-3-Clause
The Requires
by
Jake Bentvelzen
wordpress
silverstripe
1.1.0
1.1.0.0
A wordpress importer that handles various operations.
Sources
Download
BSD-3-Clause
The Requires
by
Jake Bentvelzen
wordpress
silverstripe
1.0.0
1.0.0.0
A wordpress importer that handles various operations.
Sources
Download
BSD-3-Clause
The Requires
by
Jake Bentvelzen
wordpress
silverstripe