Image 01 Image 02

0
Posted on 29th June 2008 by George

I know a lot of people have seen the custom attachment templates that are used by loads of people on Wordpress blogs, for example Matt Mullenweg, and myself. Recently, I’ve seen a lot of stuff asking how to do it, especially for images, thanks to the new feature in WP2.5, which gives sub-pages for images.

Ordinarially, Wordpress uses the post.php or index.php file from your theme directory for the image template, which just formats it exactly like any other post you can find. However, if you put in a file called attachement.php, it’ll work from that whenever it finds an attachment - this is the Wordpress theme hierarchy.

To make your own attachment template, take the contents of your post.php file and make a new file called attachement.php - then modify the layout to exactly how you want it. That part is simple.

Problem is that Wordpress doesn’t show the image as part of the_content() in the template anymore, so you need to find it manually. Never fear, however, because this is really simple. If you put this code in where you want your image to be:

<?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?>

Then it’ll show up. Obviously, if you change ‘medium’ to ‘large’, you’ll get the full size image and so on. Then you can move the

<?php the_content();?>

to wherever you want the image caption to be, because that’s all that will be there. It’s awesomely simple. You can also link to the full size image using a bit of code like this:

You can see the full size image <a href="<?php echo wp_get_attachment_url($post->ID); ?>">here</a>

Nice and simple. Now, upload the file into your themes directory, and voila!

Popularity: 49% [?]

0
Posted on 8th June 2008 by George

I’m sure there have been thousands of posts out there that say this, but I’m damned well gonna say it too.

You MUST backup your blog! I’ve talked to people who never really thought about it or bothered, and then all of a sudden crisis happens, their data is gone, and their precious blog that they spent months on it dead.

I’m entirely familiar with this - it happened to me. Thankfully, it was quite a while ago, while I was still experimenting and I didn’t lose very much. At that time, I decided that regular backups were a must. It’s fairly simple to do, there’s a nice automated backup plugin which does the job nicely - I email myself a copy of my database every morning at the moment, and upload it onto my bingodisk, all good. It’s then saved in 4 places, and I’m sure there is more chance of me becoming the King of England and the president of the US than them all going at the same time.

So yeah, go forth and backup. NOW!

Popularity: 32% [?]

0
Posted on 3rd June 2008 by George

Let’s face it. Some days we have hundreds of ideas, and others we have none. It’s a problem that all bloggers have, so here’s a nice suggestion: schedule your posts.

Why not, on the day that you have hundreds of ideas, write up 2-3 of them, maybe more. Publish one that day, and then set the next ones for the next few days, through the post timestamp function. Then, if you have ideas tomorrow, schedule them for after that.

This way, you’ve got posts most days, which makes your blog seem more active, and you don’t have to bother on some days if you like, you know that it’s going to automagically post something for you :)

Popularity: 31% [?]