Share via


Import your WordPress data into Oxite

Have you tried Oxite yet? Like what you see? Maybe you have a WordPress blog you would like to migrate to Oxite? I have written a very bare-bones import process that will allow you to import your WordPress data into Oxite. Right now I only handle Posts, but I don’t import categories yet; I’ll try to improve the process in the future.

Before using the tool, you must export your data from WordPress. In the Admin interface, go to Manage and then Export. This will let you generate an XML file containing all your posts and their categories.

You will then use this file to import the data into Oxite.

To install the WordPress import page: download the ZIP file below, and add the files into the OxiteSite project. This will add an ImportWP.aspx page. Run Oxite and load this page. It will present you with an Upload control you can use to send your WordPress XML export.

If you look at the code you will see it is very simple! The main method to create a Post in Oxite is as follows:

    1: protected void Create_Post(string title, string bodyShort, string body, string slug)
    2: {
    3:     IPost post = PostRepository.CreatePost();
    4:     
    5:     post.Title = title;
    6:     post.BodyShort = bodyShort;
    7:     post.Body = body;
    8:     post.Slug = slug;
    9:  
   10:     post.CreatorUserID = importUser.ID;
   11:     post.State = (byte)EntityState.Normal;
   12:     
   13:     post.Published = DateTime.Now.ToUniversalTime();
   14:  
   15:     PostRepository.AddPost(post, null);
   16:     PostRepository.SubmitChanges();
   17:  
   18:     AreaRepository.AddPostToArea(post.ID, blogArea.ID);
   19:     AreaRepository.SubmitChanges();
   20: }

One thing you should probably change is the IUser to use to import; by default I will use “Admin”.

Have fun!

[update] After discussing with the Oxite team, I realized I didn't handle properly the Body and BodyShort fields. I will post an update later on with details and a new version of the migration tool!

Comments