Wordpress Importer

Permalink
Hey there. I am developing a site that needed 500+ news items migrated over to Concrete5 from a Wordpress XML export. I found one add-on that helped but found very little implementation help to go with it.

Here is the package I found that worked to an extent...
https://github.com/concrete5/wordpress_site_importer...

With this I was able to install the package, and import the data into the new site's database. From there I had all 500+ pages listed in the dashboard sitemap but when I clicked to visit the pages they would be blank.

To get around this I built a custom 'content' template that works for my purposes and created a page_type that had an empty 'content' block and specified it to use this custom block. Then when importing the wordpress XML you specify this new page_type.
<?php 
   defined('C5_EXECUTE') or die("Access Denied.");
?>   
<?php
         $query1 = "SELECT cvName FROM CollectionVersions WHERE cID = $cID";
         $result1 = @mysql_query($query1);
         $row1 = mysql_fetch_array($result1);
         echo "<h1>" . $row1['cvName'] . "</h1>";
         $query2 = "SELECT * FROM WordpressItems WHERE id = '$cID'";
         $result2 = @mysql_query($query2);
         $row2 = mysql_fetch_array($result2);
         $wpStuff = $row2['wpItem'];
         $wpStory = $wpStuff;
                  $theStartPos = strpos( $wpStuff, "<content:encoded><![CDATA[" );
                  $wpStuff = substr($wpStuff, $theStartPos);


Basically, I tapped the database 'manually' to get the data (which is still in XML format, btw) from the WordpressItems table (which is separate from other content) and then chopped it up using the opening and closing <content:etc> tags in the XML to get the main story to display. I am sure there is a better way to do this and please feel free to make suggestions.

Two things I found that needed to be done in order for this to work...
1) the imported wordpress content starts its 'id' at 1 which is fine if the corresponding 'cID' is the same. I, however, already have a couple dozen pages in the concrete site and this throws the page title and content off. To get around this, i first checked the highest 'cID' using phpmysqladmin and then set the auto-index for the table 'WordpressItems' to that value+1. This successfully set the new page 'cID' values that Wordpress importer creates automatically to match the new 'id' entries in the 'WordpressItems' table.

2) datenav doesn't list these pages for whatever reason. It will display if I visit each newly create page and click to edit the datenav (without doing anything) and click update. i have not been able to do this successfully in the page_type defaults.

Like I said, I am sure there are plenty of ways to get this to work and being a novice in C5, XML, PHP, and hanggliding I can guarantee it. But, having not found any discussion on this subject I figure my hack is a good place to start.

Cheers,
Chrouglas

 
Chrouglas replied on at Permalink Reply
Ok. little update... I managed to get the datenav to work... err... the geniuses that concrete5 managed to get it to work rather. I just updated the search engine index under the maintenance section in the dashboard and there they were on each page.

me <--- novice

Cheers and thanks C5 for a great system.
C