I’m getting to love WordPress more and more and the more I tweak the redesign of this blog, the more I learn about it. One design decision I made with the redesign was to not include the entire post on the index page, but instead have summaries and a link to read the rest of the entry. I much prefer this kind of layout for a blog as it’s easier to see the content you want to read more about, rather than having to scroll through acres of images and text you’re not interested in.
So when I did this I found that my main blog page started looking really boring and text heavy, so I thought I’d include in the summary the first image within the post, but then each post looked different and as I’m very particular about little details I decided to learn about custom fields and see if I could use a custom field to introduce a thumbnail next to the summary of each post.
So to do this I needed to edit the index.php file and add the following code:
I also styled “postthumb” within my CSS file so that it floated to the left and had a margin to the right and bottom to add a space between the thumbnail and text.
Then in order to add the thumbnail to each post I had to create a custom field called “frontImage” and then put the location of the thumbnail into the value box. Once I created the first custom field with the first post I edited, this custom field was then by default available for each post. The bit of PHP code basically checks whether a thumbnail has been added via the custom field and if this is ‘true’ then to go get that thumbnail from the location specified in the ‘value’ box. It’s clever to know that if there is no thumbnail mentioned in the custom field, to display nothing and therefore not break the layout.
I love it! The only annoying thing now though is as I’m such a stickler for detail and because I love the new look I want to edit every single post to reflect the change – That’s a whole years worth! Not sure I’ll get round to doing it all to be honest.




