WordPress migration mostly complete

Well, that was relatively painless as such things go. I've gotten all of my posts and comments imported into jwz.org, and I have it auto-crossposting to Livejournal and Facebook.

I had a hard time getting the built-in WordPress LiveJournal importer to work (LJ's servers kept timing out!) so I wrote my own: ljgrabber.

Problems remaining to solve:

  • It's not crossposting to Twitter yet because the plugin is failing for some mysterious way. Once the Twitter app redirects back to /blog/?oauth_token=... I just get a blank page, so I can't connect the app to WP.   Update: Got it working eventually.
  • I have not yet figured out a sensible way to have a program running on the same host as WordPress post a new blog entry. I could do this with XMLRPC if I considered leaving my plain-text password in a text file to be "sensible", but alas I do not.   Update: See my wppost and ljpost scripts.

  • I'm not entirely happy with how SFC posts to Facebook; it just extracts and posts plain-text, without attempting to provide a thumbnail image (e.g.) Sadly, I think the only way to get even close to full HTML into Facebook is to let them pull an RSS feed, which means your post might show up in a week if you're lucky.   Update: Later versions of SFC are a lot better.

These are the plugins I'm currently using, FWIW:

  • Akismet -- spam blocker.
  • JournalPress -- LJ crossposter, descended from LJXP.
  • More Fields -- lets me have easy-to-edit "Music" and "Location" fields.
  • Simple Facebook Connect and Simple Twitter Connect -- a bundle of related plugins:
  • SFC/STC Comments -- lets you use your FB/Twitter identity to post comments.
  • SFC Like Button -- does that, but required a bunch of CSS tweaking to make it look sane.
  • STC Publish -- cross-post to Twitter.
  • SFC Publish -- cross-post to FB. (Works, but I do it differently now.)
  • SFC Comments -- let commenters log in with their Facebook account.
  • STC Comments -- let commenters log in with their Twitter account. (This stopped working with a Twitter API change in 2012.)
  • wpuntexturize -- Prevents WordPress from shitting all over your perfectly good double-quotes and apostrophes by turning them into some Unicode nonsense.

In an ideal world, I'd go back and hack all of my existing LJ posts to do a 301 redirect to the new place, so that Google would eventually realize that it should return the jwz.org pages in search results instead of the livejournal.com pages, but I'm pretty sure LJ's HTML sanitizer blocks any mechanism that would let me accomplish that. (Update: Instead I wrote a script to bulk-edit all of my old LJ posts to point here instead... maybe the search engines will pick up on that someday.)

I live in dread of the day when I reflexively click "upgrade" on something and all the places where I've made custom CSS tweaks get blown away. Is there some accepted way of dealing with that which is more clever than checking it all into CVS?   Update: Short answer: "no".



Update, 2-Dec-2010:


I've since added these plugins:

  • Avalicious: If you get a post from someone logging in with a Livejournal email or OpenID, this will give them their LJ avatar. Recommend you add curl_setopt($ch, CURLOPT_TIMEOUT, 1) before both calls to curl_exec() in plugins/avalicious/avalicious.php or it can slow things down.
  • Comment Reply Notification: Send commenters email when someone replies to them.

  • FetenWeb image_src Metatag: Adds a sane <link rel="image_src"> tag to all of your posts, so that when people share them on Facebook they show up with a reasonable thumbnail.   Update: Now redundant, as the new Simple Facebook Connect does this too.
  • HTML Emails: When WP sends you a notification of a new comment, this makes them prettier, and includes links.

  • Live Comment Preview: Puts a realtime-updating preview box below the comment-entry area. (I'm slightly worried by this, because it is client-side-only and doesn't do the same HTML-sanitization that WP does, but since you can only do injection attacks against yourself and not other people, I think it's safe. Dissenting opinions welcome.)

  • OpenID: Lets others post comments to your blog with an OpenID, and lets you log in elsewhere with your blog as your OpenID. It took me a while to realize that this was working because there's a syntax error in the source:
    - echo '{ valid:' . ( is_url_openid( $_REQUEST['url'] ) ? 'true' : 'false' ) . ', nonce:"' . wp_create_nonce('openid_ajax') . '" }';
    + echo '{ "valid":' . ( is_url_openid( $_REQUEST['url'] ) ? 'true' : 'false' ) . ', "nonce":"' . wp_create_nonce('openid_ajax') . '" }';

  • PubSubHubbub: Informs search engines that you've updated.

  • XRDS-Simple: This seems to be required before the OpenID plugin will allow you to log in elsewhere with your WP blog's OpenID identity. The trick appears to be to put this in your top-level /index.html file:
    <link rel="openid.server" href="http://example.com/blog/openid/server">
    <link rel="openid.delegate" href="http://example.com/blog/author/yourname/">
  • Configure Login Timeout: Lets you set the duration of your login cookie to something other than the default of 2 weeks.

  • Limit Login Attempts: Makes life harder for the botnets trying to guess your passwords.

  • And of course my own Base64 Shortlinks plugin.

Other notes:

  • I wish to allow commenters to post IMG and OBJECT tags. This is apparently rocket science.   Update: Kinda it is, yeah. You have to write a custom plugin whose purpose is to edit the hairy $allowedtags and $allowedposttags arrays.

  • I had been using All in One SEO Pack on someone's recommendation, but it appears that all that it does is add a <meta name="keywords"> link of my tags. Deleted.

  • I had been using W3 Total Cache, but further testing indicates that it is redundant and unnecessary. WP's built-in cacheing works just fine. Deleted.

  • I had been using WPTouch, a plugin for making the blog look "native" on an iPhone. I gave up on it because it was too much work to keep re-patching it at every release to get it to have the proper colors, etc. It doesn't have enough customization hooks, so I had to make changes to the source with every release. Also logging in with FB/Twitter didn't work, etc. So instead, I gave up on this plugin and instead just tweaked my CSS to make my existing theme resize properly on small displays, which is the Right Thing anyway.

If you're interested in the CSS hackery I did to bend the theme to my will, it is jwzblog.css. (A <link rel="stylesheet" goes in the Weaver 2010 Advanced prefs.)   Update: Nah, that's gone now. For a couple of years I had just been using the "Weaver 2010" theme plus a gigantic amount of CSS to bend it to my will, but in Dec 2012 I finally bit the bullet and wrote my own theme to simplify things and give me easier control.

Tags: , ,

50 Responses:

  1. Photar says:

    The new blog much more readable on iPhone now. But the pinstriping background needs to die in a fire.

  2. Petteri says:

    One thing that made me give up WordPress was problems with
    upgrades. At the time they had quite a lot of security fixes coming in
    and the upgrades were not trivial, for example critical plugins not
    working etc. Hopefully you have better experience.

    This blog already looks nicer than the livejournal one :)

    • Sean says:

      "Me too."

      I found that I was having to upgrade WordPress more often than I was posting. This could be seen as my failure for not posting enough, but I choose to blame WP. I also found that I used about 1% of its features, and the rest were just adding complexity and potential security vulnerabilities. So, I did what any sensible person would do -- I spent the weekend writing my own blog system (not the first I've written, but the first since I switched to Movable Type back in its heyday). I of course had to replicate most of the WP URL scheme to avoid having to set up redirects for every existing post. And I also had to implement some interesting formatting "features" I'd inadvertently relied on, to make the imported posts look right. But overall, being rid of WordPress has made my life better.

      • L. says:

        Roughly the same experience as Sean with Movable Type back in the day. Upgrade upgrade upgrade security vulnerability upgrade. What finally did me in was the provider changing machine architecture; the database is endian, and wasn't recoverable. I went and got a livejournal account...

  3. foo says:

    CVS, in 2010? Come on! Try something more recent, please. But yes, it's an idea... Though I would expect simple tar backups to do the trick, no?

  4. Edouard says:

    Looking great! Also, feels *much* faster.

    Thanks esp for the WPTouch plugin - honestly I find blogs easier to read on my phone than with an actual computer now days solely because of that plugin.

    Source control is a good way to control source - CVS or some other SCM I think is the best way to go. Try one with real branches (subversion perhaps? I personally use Perforce) and upgrade a branch and integrate back into the "live" version, fixing any breakage on the way. Visual diff and edit for the win. Or, you know, emacs.

  5. bbot says:

    Yeesh, a limited-content RSS feed? I guess I'll stick with the livejournal feed for the time being.

    • jwz says:

      Huh? It looks like full entries to me...

      • Edouard says:

        Full RSS entries for me too.

      • bbot says:

        That's amusing: when you click on the RSS icon in firefox, it just shows the description field for each entry, (along with the "click here to read more" link) even though the feed does in fact carry the full text of each post, and Google Reader displays it properly.

  6. Edouard says:

    Oh goody - I tried the facebook connect (to see if it worked since twitter didn't) and now I don't have any other options for posting. Perhaps deleting cookie will do it...

  7. node says:

    The OpenID plugin adds a "website" form input to the comments form. Interesting. I would've thought that it would require either the name + email or website, but it seems to need all three.

    This should post okay...

  8. Joe says:

    The easiest way I've found to upgrade WP is to use an SVN checkout, pointed at a release tag with whatever local changes you have. Ie: http://svn.automattic.com/wordpress/tags/3.0.1

    When it comes time to upgrade, run:

    svn switch http://svn.automattic.com/wordpress/tags/3.0.2

    You'll have to resolve whatever conflicts, but I think in the 5 or so releases I've dealt with I've never had a conflict. Since the upgrade is done in place, you don't have to worry about untarring over top of your customizations and in the unlikely event that WP actually deletes a file, it gets removed from your tree as well.

  9. Nick Lamb says:

    This is me trying to understand the OpenID plugin, sorry.

  10. Surely, it won't let me do this?

  11. Jake Nelson says:

    Well, there goes the last bit of reading LJ I had left. Pretty nice layout here. Tempted to try the Facebook sign-in, but I've become increasingly wary of that particular beast. FB makes me feel like I'm trying to lose a really persistent tail and he's better at navigating traffic than I am.

    Impressed that the comment importation all worked so well. Older posts look like quick RSS summaries in the list view, though they look fine in the individual entry page.

    • jwz says:

      Yeah, I wish the various year/month views displayed the full entry. That's annoying, but I don't see a preference for that.

      • Jeff says:

        It's not a preference, generally; it's theme dependent.

        So depending on the theme's author, there may be an option or it's something you can change in the theme files themselves - archive.php generally holds the key. There'll be something in there about showing an excerpt as opposed to the full article.

        Without knowing the code to the theme you're using, I'd bet you're looking at a the_excerpt() instead of the_content() in there...

  12. gryazi says:

    FWIW, the font size is just small enough (vs. LJ) to make me feel squinty at 1440x900x19" as-far-as-I-know-X.org-understands-my-DPI-correctly.

    Although the entry field here is certainly TV-show big.

    Something about all the blue feels a little eye-searing (humans have worst acuity in blue and whatnot), but hrglbrfgl nobody likes change. *shakes cane*

  13. Kevin Sonney says:

    In general, if I've made a lot of css updates & fixes, I'll for the theme they're in, and then use that.

    I also have the whole kit checked into git for tracking purposes.

    I've not had to "fix" css in any plugins (yet), but you can probably expect those to get munged by upgrades. It might be worth putting customized versions of those into your custom theme and loading them in header.php to override the "defaults" from the plugins.

  14. The only thing that I'm not liking about the move to WP is that your LJ version is easier to read. The LJ version has shorter line length (fewer words per line) and better leading. I have no complaints about the pixel width of your posts being wider, but then the text needs to be adjusted somehow to keep it readable. I'm sure a few tweaks to the CSS could solve this.

    • Jake Nelson says:

      Really? I liked the new format better for those exact reasons (also, feels faster/cleaner). Then again, I've gathered that I like wider pages than most people.

    • jwz says:

      Yeah, I agree about the words-per-line. I increased the font size a bit to accomplish that.

      It's sad that this theme doesn't scale down the large left column when the window is narrow, but I guess we live in a world where nobody gives a shit about that any more.

      Does it send you mail when I reply to your comment? If not, I wonder if there's a plugin for that, because getting mail when someone replied to your comment was a really important feature of LJ.

  15. What theme did you end up going with?

  16. Tom Sparks says:

    facebooks signin works, wish it would use a different icon tho...

  17. fantasygoat says:

    Half the fun of your posts are the comments, which are now split between LJ and here. Maybe turn off comments on LJ?

  18. hadlock says:

    Welcome to 2005(!). You did a good job with the transition; I wasn't even aware you'd changed until I saw the "image hosted at jwz.org" link on one of your more recent posts.

    • hadlock says:

      Also: there's no obvious way to get back to jwz.org/blog/ if you come here through google; the best you can do is scroll forward and back through individual blog posts

      • Jeff says:

        Click the patented JWZ "animated GIF of bodily harm" in the upper right. WordPress almost always uses a blog title or header graphic as the link home.

  19. Photar says:

    What no threaded comments? :(

    • jwz says:

      What the hell are you talking about dude?

      • Brian says:

        Looks like the mobile theme doesn't thread comments, at least on my Android phone. It just orders them by date, which is a little confusing.

  20. Jeff says:

    Hmm...when one clicks on a tag for a post (say, "lazyweb"), it looks like one gets only the X most recent posts with that tag and no obvious way of saying "Show me more". This is something of a downer. Perhaps I'm missing something?

    • jwz says:

      Ugh, that is irritating.

      • Jeff says:

        Yeah. I can also report (in response to your question to another fellow above) that I did *not* receive an email notice that you replied to my comment. True, I did enter my name and email address in the comment form and did not use Facebook, etc., but the email address I gave is certainly accurate.

        Well, in the interest of having something positive to say, I'll echo a few others here in saying that this layout is far superior to what you had on LJ, and the site loads so much faster. Just by eye-balling it, I'd say it's a full order of magnitude faster, to be honest.

      • Jeff says:

        Again, that's probably set in the theme. :-(

        There's a bunch of querystring-esque attributes sprinkled in the WordPress code; I'd bet there's a show_comments&last=20 or something lurking about.

  21. Otto says:

    I have not yet figured out a sensible way to have a program running on the same host as WordPress post a new blog entry.

    If this program is written in PHP, then you can simply include WordPress's main load file (wp-load.php) and then make a call to the wp_insert_post() function with the content of your post, expressed as an array.

    If it's not in PHP, then you could either go for direct manipulation of the database (insert the new row into the wp_posts table), or you could write a PHP program that accepts the arguments on the command line and does the post stuff that way.

  22. The mobile theme is nice, makes it very readable on the iPhone. However, I don't seem to be able to use the Facebook Connect from there. I guess maybe they're separate plugins and don't know about each other?

  23. Piku says:

    I've got the following plugins that are useful:

    WordPress/plugin upgrade timeout plugin. It increases the time that WP will wait when trying to download files off the web for upgrades - handy if you seem to get lots of timeouts when pressing "Upgrade" buttons in WP and plugins.

    Parts of the Yourls stuff which lets you generate your own short URLs rather than using some external link shortening service. This also does my twitter posting.

  24. Otto says:

    I wish to allow commenters to post IMG and OBJECT tags. This is apparently rocket science.

    Not really. You just need to add code like this into your theme's functions.php file, or in a plugin:


    add_action('init','allow_more_tags');
    function allow_more_tags() {
    global $allowedtags;
    $allowedtags['img'] = array( 'src' => array () );
    }

    That will allow img's with src's in the comments. I'll leave allowing objects as an exercise for the reader. :)

    Basically, all comments are run through the kses filter, to prevent bad things. The $allowedtags global is what defines what is allowed and disallowed. So you just have to add the tags you want allowed to the whitelist.

    More info: http://ottopress.com/2010/wp-quickie-kses/

    BTW, Protip for tiny hacks: Make your own Plugin file and activate it. Then you have a simple place to put all your own "little" hacks like these.