PHP code example of silbinarywolf / silverstripe-wordpressmigrationtools

1. Go to this page and download the library: Download silbinarywolf/silverstripe-wordpressmigrationtools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

silbinarywolf / silverstripe-wordpressmigrationtools example snippets



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;
		}
	}