In this blog…

WordPress After working with WordPress for a while we find that everyone’s experience with the system is different, and anybody’s solution might be useful for someone else finding himself in the same circumstances. Here we’ll pay our tribute to the WordPress community by uploading issues we encountered as beginners with WordPress and the solutions that worked for us.

Import large content from anywhere

This is a much better and cleaner approach to auto-importing posts from anywhere.
It requires some use of code or of regular expressions scripts (outside of WordPress) though.
Basically, you need to create an import file for use with WordPress importer.
The best way to do it is like so:

  1. Export from WordPress an existing post that has all the elements in your posts.
    You’ll need to use Tools -> Export. You’ll get an XML file where each post appears
    between the tags <item> and the following </item>.
    Find the representative post and delete all other posts (“items”) from the file.
    This is an XML file, so now you’ll have opening tags, one item’s data and closing tags.

    After every step, best using a localhost/temp copy of your blog, import the resulting file
    (changing the post title to a descriptive one like “test no.1″ and so on.
    Make sure the import was successful before proceeding to the next step.)

  2. To simplify the file (to keep it cleaner and because there’s a size limit
    on the imported file), strip all info not requested by WordPress or part of your post.
    (Again, with every tag (opening tag+data+closing tag) stripped, make sure that the file
    continues to import without error messages.

    For this example we used a basic post with title, content and one category,
    And this is our resulted file:

    <?xml version="1.0" encoding="UTF-8" ?>
    <rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.1/"
    >
    <channel>
    <wp:wxr_version>1.1</wp:wxr_version>
    
     <item>
      <title>1</title>
      <content:encoded><![CDATA[2]]></content:encoded>
      <wp:post_date>3</wp:post_date>
      <wp:comment_status>open</wp:comment_status>
      <wp:ping_status>open</wp:ping_status>
      <wp:status>publish</wp:status>
      <wp:post_type>post</wp:post_type>
      <category domain="category" nicename="4"></category>
     </item>
    
    </channel>
    </rss>

    where 1 is the post’ title
    2 is the post’ content
    3 is our intended post’ publishing date and time
    and 4 is an existing category “slug” name

    Now all that’s left is to create a file with the same intro and outro structure
    (everything before <item> and everything after </item>), and create your items
    programmatically.
    We had our content on MS Access, so we used VBA to create the formatted HTML from
    query results, and now we can import any number of new posts with 3-4 clicks inclusive!

  3. Of course, last step is Tools -> Import -> WordPress.
    NOTE: for every item, you’ll get a message that says:
    Failed to import author . Their posts will be attributed to the current user.
    That happens because of some security feature, just ignore.
    Would love an idea how to skip it all together though…

Enjoy!

WordPress debug mode?

If you have some programming background and know what’s debugging, you’d love this one:

In your site’s root directory there’s a file named wp-config.php which holds some security data about your site, including database connection parameters.

This file also includes the line:

define('WP_DEBUG', false);

On your test site, change this setting to true. This will be very revealing.
You’ll find that plugins or code snippets you added are creating many errors which although not fatal (which means the site runs OK anyway), may slow down your pages.

After first hearing of this debug mode, we had a great time and a great learning experience going over each error and fixing it, until the site ran on define('WP_DEBUG', true) with no error message whatsoever.

When finished, even if all errors are fixed, reset to define('WP_DEBUG', false);
This will prevent showing temporary errors that are nothing to do with your code.

Manual site update/ move

Our first sites were built on a local system (localhost) and then uploaded to the live site.
That gives us the freedom to experiment, while causing and fixing problems and learning as we go.
We work locally with wamp on Windows and MySQL/Access databases for external data.

So what are the basic steps for updating your existing site manually from a localhost setting?

Update WordPress database:

  1. Export local phpMyAdmin database to .sql file
    (Mark Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement
    and in case of international issues, make sure the file is saved as utf-8 Unicode).

  2. Open the resulted .sql file in a simple text editor, rename all “localhost” instances to your online site’s domain or folder, such as “mysite.com” or “mysite.com/myfolder” and save.
  3. Import edited .sql file to remote DB.

Update site’s files

Copy all updated files to the correspondent folder in the site’s file system.
DO NOT copy your local wp-config.php, .htaccess, or modules that use external database as is.
We save two copies of these files (local/online configuration) and only upload the online version.

Manual site move

Moving a basic WordPress site from one domain or folder to another is a very similar process:

  1. Move all files to the new host/directory
  2. Export old WP database to .sql file
  3. Rename all instances of “oldsite.com/oldfolder” to “newsite.com/newfolder”
  4. Create new WP database and update the connection info in wp-config.php
  5. Import .sql to new WP database
  6. Manually copy old site’s text widgets and recreate on new site.
  7. If needed, fix domain paths on .htaccess
  8. If you’re using the same external database, no changes required there.

Manual import of a BIG blog from blogger

Generally you’d want to use WordPress’ Blogger Importer but you’ll soon find out that it wouldn’t work for large blogs.

The blog we had to import had more than 2000 posts, and an exported Blogger file of over 8MB, WordPress limit being 2MB. Researched and found no working solution. Seem that suggestions to edit settings in various configuration files did not work for all, And we needed a non techie solution that will work the same day. So we decided to split our Blogger blog into smaller bloggies instead.

Took us about 3 hours to complete the job, most of it waiting for Blogger actions to finish. This process kept posts contents, dates, comments and design including pages and partial sidebar content. Note: This process (or actually the WordPress importer) didn’t keep permalinks & tags. It’s definitely not perfect, and we would love to hear about better options.

So here’s how you do it:

  1. Go to your old blog, export blog to a file on your computer. rename it “original”.
  2. Create a new temporary blog with a name very different than your blog’s (you don’t want to mix them up…) Import the original exported file to the temp blog.
  3. Go to the Edit Posts page and choose the 300 posts per page option. If your posts are small enough (as were ours), you will be able to Export/Import 300 post at a time. Otherwise, choose a smaller option.
  4. Delete all posts in all pages except for the page you intend to export this cycle. If you have 1034 posts, that’s 3 cycles of 300 posts, and a forth with 134. Start with deleting the first 3 pages. Next cycle delete 4, and 1-2, etc.
    To delete a page, choose Oldest or Newest, then Select All, then Delete Selected. At all times follow the post range at the top of the page. Note that after deleting the first page, range 1-300 is really posts 301-600!
  5. Goto the Settings page and export the 300 posts left on your temp blog. Save the file on your computer and call it, for example, 0901-1034.
  6. Go to the dashboard and delete the temp blog. Be careful not to delete your original one… BTW, Not advisable to work with the same temp blog in all cycles, since there’s some buildup of junk from every import that makes the exported file bigger every cycle.
  7. Go to http://blogger2wordpress.appspot.com/ and convert your Blogger exported file to an WXR WP import file. Don’t worry if the file is 4MB or more, the converted one will be much smaller, and that’s the one that counts. If it’s still bigger than 2MB, start again with a smaller number of post per cycle. Add to the converted file’s name something like 0901-1034 or so, for identification.
  8. Start a new cycle from step 2, this time exporting 601-900 (page 3), next cycle export 301-600 (page 2), and then 1-300 (page 1), and you’re done.

When finished, be sure to be logged in to your WordPress site as the author intended for these posts.
Use the WordPress Import plugin to import the resulted files, one by one. Don’t worry about the order. WordPress will use the original posting dates.
Since each import also includes all your Blogger pages Etc. you’ll have to go over your new blog and clean all redundancies (and then maybe use some revisions cleaning plugin).

Mission accomplished!

Powered by WordPress | Theme by New WordPress Themes | Icons by IconArchive.com | Hosting by orrdata.com