Reminder: Don’t Forget to Backup Your WordPress Database!

This wasn’t going to be the subject for my post today, but a series of events have changed my mind. Here they are:

Yesterday on my blog, WPShout I published ‘10 Awesome Things to Do With WordPress’ Custom Fields‘. This morning I awoke to find not a single comment on the post. I was disappointed as the post had taken ages, but I didn’t think much more of it. Until this evening. I wanted to email a friend a link to the post, so I loaded up WPShout, only to find the post wasn’t there! In the admin was only my draft from a couple of days ago. Odd, I thought. I copied and pasted the post from Google Reader and republished the post. And then I realized that a heck of a lot of comments I’d spent yesterday evening replying to had gone, and so had my replies. In other words, my database had reverted to a version a couple of days old. Why? I don’t know (if anyone does have any idea, could you drop me an email?!) at this point.

Of course, at this point you’re (probably not) screaming at your monitor

“just restore the backup you’ve got!… you, you do have a backup, right?!”

Yes. Of course I did. Or so I thought. I’d set up the WordPress Database Backup plugin to email me a backup of the database every 24 hours, and that email automatically got archived. Which meant I didn’t see it hadn’t been sent for a couple of weeks because when moving domains I’d forgotten to reinstall the plugin. Which meant I didn’t have a backup.

Where this post is going is simple – don’t be an idiot like me and only realize your backup doesn’t exist when you actually need it, spend five minutes now installing the plugin I mention above and set it up to email you every day. Just don’t archive the email automatically. WordPress Hacks Top Tip: don’t be an idiot….always have a backup.

Tweet This | Digg This | Stumble it |

WordPress News & Notes – July 24, 2009

These days there are so many excellent WordPress blogs and articles, it can be hard to keep up with all the brilliant WordPress articles around, so here are some great articles I’ve saved on my feed reader; feel free to add some posts you’ve found around the web in the comments.

  1. First up, ‘10 Handy WordPress Comments Hacks‘ on Smashing Magazine by Jean-Baptiste Jung of WP Recipes fame.
  2. Next, a post on Chris Coyier and Jeff Starr’s Digging into WordPress caught my eye: ‘Include jQuery in WordPress (the right way)‘. In this post, as you might have guessed, Chris shows how to include jQuery the right way – using the copy of jQuery built into WordPress.
  3. Third, a post on WPWebHost in two parts – ‘Securing your WordPress Install the Foolproof Way’ – parts one and two. A couple of tips in there that you might not have thought of.
  4. Another post that caught my eye was ‘Multiple WordPress Loops Explained‘. I would say more, but it’s pretty self explanatory.
  5. A post that has been around a while, but is worth mentioning anyway – WPCandy presents ‘10 Things You Can Do With WordPress Besides Blogging‘. Again, pretty self explanatory, but definately worth a look.
  6. And finally, a little plug for a post I wrote the other day – ‘10 Tips to Improve Your WordPress Theme‘. Check it out. Some rather nice tips in there.

And there we have it. Six links of note!  Add your own in the comments.

Tweet This | Digg This | Stumble it |

How to: Use Thumbnails Generated by WordPress

One of ten brilliant tips that I shared yesterday on my blog – display images on your blog’s homepage without any custom fields or any additional functions.php script, something I first saw on  WebDeveloperPlus.

How do you do it? First log in, on the sidebar select ‘Media’ (which is under ‘Settings’). You’ll then be taken to a page with an option to change the thumbnail size of images. Change that to whatever size you want your images to appear as. Next, insert the code below onto your homepage, archive page, whatever.

<?php
//Get images attached to the post
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'numberposts' => -1,
'order' => 'ASC',
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
$img = wp_get_attachment_thumb_url( $attachment->ID );
break; }
//Display image
} ?>

Then, to display your image you can just echo out the $img tag we just created:

<img src="<?php echo $img; ?>" alt=" " />

And there we have it. I told you it was easy! This is one of the tips from a post I wrote yesterday on WPShout – ‘10 Tips to Improve Your WordPress Theme‘.

Tweet This | Digg This | Stumble it |

Security Update: WordPress 2.8.2 Released

Although it isn’t very long after WordPress 2.8.1 was released, WordPress 2.8.2 was just released today and is a security update which corrects a XSS vulnerability which was discovered.   Comment author URLs were not fully sanitized when displayed in the admin. This could be exploited to redirect you away from the admin to another site.

Due to this being a security update, it is strongly recommended that you upgrade your WordPress 2.8 installations as soon as possible.  This can quickly and easily be done via your WordPress administrator panel (for WordPress 2.7 and newer installations) via Tools –> Upgrade, or you can manually download it here

If you’d like to read the official announcement, you can see it here.

Tweet This | Digg This | Stumble it |

Alex Denning: A New Contributor to WordPress Hacks

Editor’s Note: Although Alex has published a few posts here in the past, he is going to ramp up his submissions over the coming weeks, so we decided he would do an introduction post.  If you’d like to write for WordPress Hacks, you can get more information here, then contact us.

After Kyle announced in his last post that he would not be able to resume WPHacks’ regular posting schedule for awhile, I volunteered to step up to the plate; for the next fortnight I’ll be taking Kyle’s place and plan to be posting at least once every other day!

Me.

For those of you who don’t know, I’m Alex Denning. I’ve written the odd post here on WordPress Hacks, as well as occasionally writing posts for CatsWhoCode and ProBlogDesign. Recently I started my own WordPress blog, WPShout.com, and I also am the editor of Nometet.com.  I’m on Twitter too!

What I’ll be posting

As I said, I’ll be posting at least once every other day with a bit of discussion, some nice WordPress hacks, some WordPress news, etc. However, I haven’t got enough post ideas for the entire two weeks; any suggestions for posts would be greatly appreciated in the comments.

A quick plug

As with everything in life, my posting here does too have an ulterior motive; I’ve briefly mentioned my blog already, but I’ll expand: my blog has just (I say just, ie today!) changed its name from Nometech.com to WPShout.com and it has also got an exciting new design. As you’re reading WordPress Hacks, that implies you’re a WordPress fan, so I’ll make a quick prod in the direction of the WPShout RSS feed; a couple of times a week I publish in depth posts related to WordPress. I’d hope the content speaks for itself, so go take a look!

Wrapping up

I think that’s everything! As I said, any post suggestions or questions?  Please do leave a comment below, and here’s to an excellent next two weeks!

Tweet This | Digg This | Stumble it |