Support » Fixing WordPress » Scripts to convert plain html to wp database entries?

  • I used to have a sorta blog where I just managed it with straight html editing and ftp uploading.. but I got sick of the look, and I am really liking wordpress, so decided I’d like to switch over.

    The big problem of course is converting all my entries. It would be possible, albeit tedious, to do it by hand, but I know enough computer whiz types (though I myself am not particularly in that category, but I can learn) to know that there’s probably a way, though it might be complicated, to convert this.

    Luckily for me the entries I’ve made are all consistently formatted (or at least there are blocks of consistentl formatting in between style changes, but I can separate those out into separate documents pretty easily) so I’m thinking if I can somehow point some sort of script to parse through the files and detect the ends of entries based on <hr> tags, and the date based on a certain format etc, perhaps this process would be a little easier/possible.

    My problem now is that I know nothing about scripting, or how I could set this up to interact with the WP database, so if anyone could point me in the right direction I would be thrilled.

    thanks a lot in advance.

    (my old site is and my new one for now is

Viewing 11 replies - 1 through 11 (of 11 total)
  • My problem now is that I know nothing about scripting, or how I could set this up to interact with the WP database, so if anyone could point me in the right direction I would be thrilled.

    So many ways to achieve this, but just use PHP in this case. Basically, learn PHP in areas of file I/O, string and/or regex. And then you have to know SQL also.

    Basically recognize input as date, as entry, etc and insert them to the appropriate row/column in mysql table.

    The concept is easy, but takes time nonetheless. It’s probably tough for you, so if I were you I’d get someone to do it for you if you want instant gratification.

    Support my campaign

    I’m not sure I’ll be able to find someone willing to do it for me.. so I may be having to learn some php.

    Where do I start? what programs will I need?

    You will need a web server configured with php and myql. You could do it on the host that you have or you could install the following on your computer. (highly suggested)

    That package above will install apache, mysql, php on your computer so that you could execute php script. You could even install WordPress on your computer after.

    To create php script/file, you just need a text editor (notepad) for now. Make sure to save the file in appropriate directory, you could then use internet browser to see the result.

    I can’t believe you’re willing to do this. Anyhow, good luck.

    Mark (podz)


    Support Maven

    Skeary – one option of course is just to leave your current work as it is, as archives. You can certainly point to them with links from WP, and add links back, but then I guess you need to balance the time / energy / cost against what you see as the benefit.
    I’m not saying you should not – just that you should not feel you should 🙂

    yeah.. I’ve thought of that. I just can’t stand looking at my old page anymore. So ugly. And I sort of like pointless busywork.

    Well, I went through the same thing as you, debating and deciding, and finally decided to import them all using the import-mt.php utility provided by WordPress.

    The task isn’t easy and it took a lot of thinking and planning, but here are my steps and tips as I worked it out. It’s worth it when it’s done, but the cleanup still continues as every once in a while I find a bit of borked HTML, but it works. I hope my tips and information will help.

    I’m going to clean that up soon and turn it into an article for the Codex…soon.

    wow lorelle thanks a ton! I didn’t know about the wordpress import thingie (new and all), so this is *very* handy. Since my dating and such is fairly consistent I might try and set up some kind of macro to automatically assign the dates and stuff since it will be fairly time consuming to do it all by hand. But thankfully I edited my previous site by pasting the old one into an archive page and editing the old one, so the formatting is consistent (at least within blocks), so hopefully I can streamline the process somehow. My brother knows a lot of coding and scripting, so I’ll try and get him to give me a small hand.

    I list several very useful search and replace features in the article, that may prove VERY helpful. Good luck with it.

    Just one quick clarification, when I am ready, I just navigate to the import-mt.php and it will ask for the location of the file?

    aaand.. if I already have some content on my new blog, it will remain intact?

    thanks a lot.

    lol. how convenient.. turns out my brother put on his resume that he knows c sharp programming (which he’s just learning) and he wants to be able to say he’s done something with it, so he’ll help me to automate this process in ways i never thought were possible. And with any luck some of the results would be usable by others.

    So what happened with this, I need a similar thing done, can anyone in this post help?


Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Scripts to convert plain html to wp database entries?’ is closed to new replies.