Migration Back to WordPress
Yes, as if the credit link at the bottom of the page and the various “WordPress-esque” features hadn’t already given it away: I’ve moved back to WordPress. Before the geeky among you gasp and sigh (and the likes of my Mum wonder what the fuss was about) I will explain.
For about 6-8 months now I’ve been having problems with my website increasingly maxing out its MySQL max_connection limit. Originally I thought this was a symptom of my own popularity (heehee) but bloggers with similar stats weren’t having my problem.
I removed comments from articles, this seemed to help for all of 2-3 days. I removed all MySQL connections from any page that wasn’t related to my blog. This plugged the gap for longer but slowly they came trickling back. I completely recoded huge chunks of my site not long after my birthday which made bugger all difference whatsoever. I even spent days going through with Site5 my problem and getting them to give me examples from the slow query log (funnily enough, Mint was the biggest culprit there!)
Anyway, it got to the stage where the only thing that stopped the errors was to completely de-MySQL my sidebars on the posts. At first this felt like no big deal but I sat there a couple of evenings ago staring at my site, with this overwhelming feeling that I’d totally raped it of all functionality simply to comfort my inner stubbornness. So, this is the part where WordPress comes in. I decided to bow down to the collective “genius” of developers around the globe who have a lot more experience of optimisation than I do, and have crawled back.
I have to admit I don’t feel bad about this at all though. I am positively blown away by the new WordPress 2.5. It is faster, and much more sleek than any version I’ve touched since 1.5 and I find the admin panel a massive improvement on those that came before it (which is funny when you consider how many people are slagging it off right now). I’m hoping that with the changes, and a copy of WP-Cache2 I’ll be able to solve all my problems (and I’ve not considered what I’ll do if it doesn’t.)
I’m not running a vanilla copy; I’ve already hacked bits about to do what I want. I will share changes as I go along, starting off with…
The Nitty Gritty
Porting over my posts was easier than I expected because WordPress has built-in import from RSS functionality. However, it wasn’t until I was half-way through recategorising my posts that I realised it had done the IDs backwards (my latest post had an ID of 1 and the first in the database some huge number over 600). By that time it’d taken me about 6-7 hours to put about 300 posts into categories so I was f*cked if I was starting again.
After getting the posts in I set up my theme, which is basically identical to before (except I decided to go with Tahoma instead of Arial). I’ve set up my Asides using the WordPress get_posts() template tag, code as follows:
<ul class="asides">
<?php
$asides = get_posts('numberposts=3&offset=0&category=7');
foreach($asides as $post) {
setup_postdata($post);
?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">#</a> <?php the_content(); ?></li>
<?php
}
?>
</ul>
I’m using query_posts() to get the latest posts from my SEO/Security categories which are highlighted in the sidebar, although I’m not sure if there’s a more efficient way to do it because it’s been a while since I’ve played with WP and most of the original template tags seem to be deprecated.
I’ve got get_permalink() everywhere so that I can run a copy of my website offline without cocking up the structure using SE-friendly permalinks and amongst other things, fixed a sneaky register_globals dependant $PHP_SELF in vars.php (line 18) Amelie says it’s a created, sanitised variable from elsewhere.
Importing comments was more difficult than I originally hoped, both because of the IDs mix-up and because WordPress doesn’t have a facility to do this for you. I wrote a converter which pulled all WP posts into an array with the ID as the key and the post_name (the “friendly” version of the title) as the value. I then pulled all 15,000+ comments from my database comparing my comment location value with the original post ID from my script and generated the new ID by comparing titles. It was only about 20 lines of code and sounds more complex than it was ;)
I synchronised the individual comment counts in the WP posts table with the following line of SQL:
UPDATE `wp_posts` SET `comment_count` = (SELECT COUNT(`comment_post_id`) FROM `wp_comments` WHERE `wp_posts`.`id` = `wp_comments`.`comment_post_id`);
I’m now in the process of moving over all of my content and will then convert my old styles to WP themes so you still get the option to switch styles. I can then start going through and setting up redirects so that people get my new db-powered pages instead of the old files. It’s going to be a long process but I think it’ll be worth it.
Rachael said:
On 05 Apr at 9:39 pm
I hope WP treats you nicely.
And boo @ you playing that horrible trick on us! I almost fell for it. ;)
Jenny said:
On 05 Apr at 9:44 pm
Aw. You’re not pregnant. :(
Sounds…fun, though–converting and all that. :p
Amber said:
On 05 Apr at 9:45 pm
I never thought I’d see the day. However! I am a wordpress fan, so I understand. After the initial “I HATE 2.5, I’M SO CONFUSED!” I prefer the set-up to the last and am happy again (well, after getting rid of the horrible orange anyway).
Amelie said:
On 05 Apr at 9:45 pm
Are you not going to put your old permalink structure back? Easy peasy… In one of the function files (…don’t ask me which one, maybe functions.php) it has the thingy wot converts your titles into this-is-a-title type stuff. Change the – so it uses _ instead. Then in your permalink thingy, enter %year%%monthnum%%day%_%postname% Tada!
I’m sure you already knew this, but if not then you do now. :P
Jem said:
On 05 Apr at 9:46 pm
I didn’t like my previous permalink structure Amelie, I just couldn’t be arsed to fix it.
Aisling said:
On 05 Apr at 9:46 pm
I hope you’re not using the icky orange admin panel. The blue one is much nicer. :)
Rachael said:
On 05 Apr at 9:49 pm
Are you gonna use Melissa’s handy tutorial to get your FAQ working with WP?
Oh wait… you don’t use bellabuzz… :(
lemm said:
On 05 Apr at 9:51 pm
Yup, WordPress has really cleaned up admin wise…I used to find it really awkward to use. Anyhow congrats, because that sounds like many hours of work to me. Don’t wear yourself out! :)
Renate said:
On 05 Apr at 10:12 pm
Here I was feeling all good about myself just because my upgrade to 2.5 went smoothly, and you have to come along and be all WordPress super-savvy. Sigh!
Sorry to hear about your MySQL troubles though, I hope WordPress will treat you well. :)
Meli said:
On 05 Apr at 10:13 pm
Maybe this seems kind of insensitive, but… I’m kind of glad you’re back to WP so that you can unleash your genius on something we all use. I’m anxious to see what you do with it.
I’ve never seen asides done that way, by the way. It looks more intuitive than what I’ve got. Hmm…
Jem said:
On 05 Apr at 10:56 pm
OK, time for bed. Y’all have to tell me if you come across any errors tonight.
Hannah said:
On 05 Apr at 11:30 pm
I thought this was a late April Fool’s joke at first :P
Good luck with using WordPress, sounds like your conversion was hell o_o
Loadx said:
On 05 Apr at 11:45 pm
Good news you got it all to convert and one day before my birthday none the less.
I have to be honest, I too am very impressed with what the wordpress team are doing. I do however feel that their ‘one size fits all’ mentality is wrong for their market and that if they were to analyze what features their various audiences want then they could craft some pretty nifty ‘out of the box’ installs.
I do indeed look forward to hearing what you do with it. I know i customised my WP long ago but I really just can’t be bothered blogging anymore….yes, I know I was going to use google notebooks but I got lazy about that too.
What mods are you currently running?
Also on the issue of your max_connections problem, were you using mysql_pconnect()?
Anywho, Take care.
Mat.
Crystal said:
On 06 Apr at 12:18 am
Welcome back to the Good side =D
Ramsha said:
On 06 Apr at 12:47 am
Sounds like you spent quite a chunk of your time converting. I hope it’s worth it though.
Bubs said:
On 06 Apr at 12:55 am
I haven’t had a chance to even take a look at 2.5, but I’m looking forward to upgrading! Maybe we can collaborate on some super cool plugins now that you’re a full-time WP user :)
Rhian said:
On 06 Apr at 2:09 am
Wasn’t purposely looking for errors but noticed that the “Favorite Links” header is linking to this page.
Hev said:
On 06 Apr at 3:20 am
Welcome to the pack, Jem. I can’t wait to see what plugins you decide on. Maybe you will even make more themes.
Vera said:
On 06 Apr at 6:04 am
OK, Rachael is really scary! How could she have predicted such a thing… even if by mistake @_@
Well I still have to update to WP2.5… yeah shame shame, but I’m getting on it… um.. sometime today.
Oh well, that doesn’t mean you didn’t have a fun time using your own CMS. So hopefully, now you won;t have those problems anymore.
Hanna said:
On 06 Apr at 6:13 am
Well you have to do what work for you, hopefully no problems any more.
WP 2.5 seems definitely nicer than previous versions, at least faster :)
Lene said:
On 06 Apr at 6:34 am
Welcome back to WordPress, I guess ;)
You know, I had that mysql error too with wordpress 2.3.3, I hope it doesn’t reappear in this version!
Malin said:
On 06 Apr at 7:49 am
If you posted this on April the 1st I wouldn’t believe you :P Good luck with it :)
Vixx said:
On 06 Apr at 8:09 am
Welcome back to the dark side. You’ll love it here.
V xx
Mumblies said:
On 06 Apr at 8:14 am
Ooh pics :) Nice touch, as for the rest…Umm…Yeah…Right…Ok, I give up. None of that made any sense to me hehe.
I preferred the last font though.
Rhys said:
On 06 Apr at 10:12 am
WordPress?!?! What next?!?!? Adsense????
Ann said:
On 06 Apr at 11:20 am
So, this is the reason your theme switcher doesn’t count on the homepage any more. Makes it look strange when you navigate between pages now though :p
Matt said:
On 06 Apr at 11:37 am
I must admit I’ve been visiting your site a lot less lately and part of it, as lame as this sounds, was the sidebar. It just felt… totally incomplete and it was bugging me. I think you’ve done the right thing converting back to WordPress. I hated seeing your site.. emptyish.
Jessica said:
On 06 Apr at 12:37 pm
Oi! I never thought you’d switch over to WordPress. On the first sight I didn’t even noticed that anything had changed. ;) Good luck on getting everything fixed asap. :)
Shaun said:
On 06 Apr at 2:19 pm
The “Older entries” link doesn’t work anymore. Clicking on it directs you to a new URL, but with the same content as the first page had.
Barbilee said:
On 06 Apr at 3:54 pm
LOLZ i did not know you liked wordpress :) i hate the new one b/c my pretty pink dash looks like utter crap and my logon page i made looks like crap too :(
but yah …… i am glad you like it its so much better than that damn cutenews i was usesing in the beging and now i found a love of bloging
Melissa said:
On 06 Apr at 4:37 pm
Woot, Jem! I wouldn’t have noticed a thing either except for the change in font. Good luck with all the customization of things. Are you going to be using any plugins?
I do agree that the new admin panel is 200% better than before and really don’t get either why so many people are whining about it. There are just a few tiny things I would change (mainly style-wise) but nothing I can’t live with for the time being.
And you beat me to the asides snippet! I was going to post about that EXACT way too, as I had switched to it from the plugin I was using. :P
Han said:
On 06 Apr at 5:49 pm
Welcome back to the dark side ;)
I dont know why people dont like the new admin page – I luffs it!
Amelie said:
On 06 Apr at 7:28 pm
Pssst… The “register_globals dependent $PHP_SELF” you talk about isn’t all it seems :P Look at wp-settings.php, lines 93-95 or thereabouts. It’s actually a sanitised version of $_SERVER[‘PHP_SELF’] (which is also sanitised, mind you).
Amelie said:
On 06 Apr at 7:29 pm
Blimey, the :P smiley looks like it’s got a dog poo on its mouth. :|
Jem said:
On 06 Apr at 7:34 pm
Ah well, now it’s a sanitised $_SERVER[’PHP_SELF’] in the page too ;)
Dee said:
On 06 Apr at 11:47 pm
WordPress 2.5: The Dark Side Has Never Been So Delicious.
Sarah said:
On 07 Apr at 1:50 pm
Glad to hear you sorted out the issues and also liking WordPress 2.5. :)
Erin said:
On 07 Apr at 6:27 pm
Oh Jesus, Jem. I’ve just upgraded too (rather Birgit did for me) and now I’m completely at a loss as to how to edit the Theme defaults. It says I need to allow myself permission? D=
I’ve attempted CHMODing the index page like the article links to and yet it’s still giving me problems. I bloody hate the Codex. If you have any time to shoot ideas my way, I’d greatly appreciate it.
And I’m glad you were able to finesse it so easily!
Daz said:
On 08 Apr at 8:06 am
Yey WordPress :D Good work on the migration :)
v2.5 got me too curious about it, so I’m now mid-converting my site to it!
The Woes of WordPress — jemjabella.co.uk said:
On 20 Apr at 7:09 pm
[…] converting back to WordPress I’ve been having some difficulties with my site. It’s not the fault of WordPress per se […]
Steven said:
On 21 Apr at 5:42 am
Optimization has never been my strengths in PHP. :P I suppose I just code what I want it to do and not worry about what kind of impacts it may have. :P For instance, (and thanks for the link to Gravatars), I’m reprogramming my blog AGAIN from scratch and now… I might have to go WordPress. :P
Have fun! :)