Updating WordPress? Backup first!

I’m sure I’m not the only one who has been a little slack on occasion when updating their version of WordPress and not doing a backup. It sounds such a stupid thing to do, especially when you think about the time you’ve spent working on the site and the time you may well need to spend fixing it!

One of the things that I hated was doing an ftp download of the site. I never got on with backup utilities very well as I wanted to be in control. So, a few years back I realised there was a far simpler method to maintain backups using the Terminal in Mac OSX.

ssh username@yourdomain.com 
cd httpdocs // or whatever your WP root directory is
mysqldump -u username -p database > backupdatabse.sql
[Enter password]
tar -vcf backupfilename.tar .

And that’s pretty much it. It creates two files in your WordPress root. You can secure copy (scp) through the terminal if you want or download using ftp. Either way, the above takes very little time to do and gives you the opportunity to restore things to how they were if it does go horribly wrong.

Create WordPress Short Code

To create a shortcode for html add the function into functions.php. Then add the style to style.css. Here’s an example:

For functions.php

function codetext_shortcode( $atts, $content = null ) {
   return '<div class="codetext">' . $content . '</div>';
add_shortcode('codetext', 'codetext_shortcode');[/codetext]

For style.css

.codetext {
 font-family: "courier new";
 font-size: 0.8em;
 color: #333;
 padding: 10px 0 20px 0;

Bird-Feeder for WordPress Tweets

After a quick review of the WordPress plugins available for Twitter (and there are a lot!) I finally plumped for bird-feeder. I only want a lightweight plugin that pushes my blog posts out to twitter using the title as the text. Something that bird-feeder is designed to do and that’s it. I looked at  tweetsuite and tweetmyblog but the first seems to be overkill at the moment and the second feels a bit too self-congratulatory and a bit like you’re talking to yourself too much … give me time – I might change my mind once I get going.

Although new to Twitter, it seems to me a way to get news out to people and to link to more in-depth articles. Having it the other way round would certainly drive traffic to a blog due to the number of links being generated but is it some kind of new link-spam? I’m not sure. Maybe I’m in the minority here but it feels a bit like that. That said, it would be worth experimenting to see the effect – one month without and one month with and see if there’s much difference.

Magento and WordPress Side by Side

Magento is a great piece of kit and is taking the e-commerce world by storm. However, unless you have a good understanding of object-oriented programming and are familiar with extended classes you’re going to struggle a little. At the moment I’m redesigning a client’s site to incorporate an intial splitter page as the home page that then allows them to pass through to the catalogue proper or to the blog.

However, the way I chose to do this was to copy the html source from the home page and redo the html and css manually. However, I’m sure there must be better ways of doing this, such as using includes on particular features. The problem is that the only method I could think of was using an iframe, something I didn’t want to do for reasons that go without saying

As it stands the only drawback is that changes to the Magento catalogue navigation will mean the need to update the static html in the new home page. This is a bit of a bind but isn’t too problematic as the links are permanent. It’s only really when a new section is added that the page will need to be added.

It’s a relatively simple solution without needing to get into Magento code. I’m sure it could be done in a sweeter way but this seems to be the least complicated way and one that fits with the client’s budget.