Amadiere.com

Fourteen and a half crazy frog burpers

5th November 2009

Quick Start Guide to Theming WordPress

Filed under: Web Design,Wordpress — Tags: , , — Alex Holt @ 8:01 pm

It’s taken a while, but I finally revamped the look of my site. Part of the problem, as always, is coming up with a design I can put up with for a while. I think that this red attempt should be OK for a while.

There a number of good WordPress theming guides out there (the one at WPDesigner.com is especially excellent) , so I don’t intend to replace them and their great detail. This post is merely some simple pointers for those that already know how to create HTML and understand enough about PHP to get by.

Create yourself a design! I’m totally gonna gloss over this part, despite being the major time consuming bit. I’m a big advocate of the multiple stage design process (Image -> HTML -> System Template). Basically – once you have a HTML / CSS version of what you want to achieve, its then time to work on how to get that into your WordPress Blog.

Create yourself a theme directory – this is within your /wp-content/themes directory and should make your theme sound totally awesome. Something like “Totally Rockin’ Monkey Burgers” should be sufficient.

Create your CSS file – Just copy your CSS file to your theme directory and make sure its named stylesheet.css You should also make sure you have something like the following in the top of it:

1
2
3
4
5
6
7
8
9
/*
Theme Name: Totally Rockin' Monkey Burgers
Theme URI: http://www.amadiere.com/blog/2009/11/quick-start-guide-to-theming-wordpress/
Description: Theme creation example.
Author: Alex Holt
Author URI: http://www.amadiere.com
Version: 1.0
Tags: red,white,fluid-fixed-width,two-columns
*/

Copy the PHP files from the Default theme – these act as a great starting point for your adaptations. You can now adapt these to pull together to create your style. They are split into 5 easy to comprehend areas by default. You don’t need to follow this however, you can simply put everything in one big file – though I find code becomes a lot more manageable when split over a few pages:

Index – the glue of the page, it calls the other templates where required. The key lines are:

<?php
get_header();
get_sidebar();
comments_template();
get_footer();
?>

Header – has the top part of your blog that is repeated throughout your site.

Footer – similar to the header, the code that appears at the foot of every page.

Sidebar – your navigation bar. For this, you effectively only need a small bit of code. The ‘dynamic_sidebar’ function calls all the Widgets that are enabled. This then basically generates a load of <li>’s, one for each Widget (these sometimes have nested UL’s and LI’s themselves):

1
2
3
4
5
6
7
<div id="navigation">
  <ul>
    <?php 	/* Widgetized sidebar, if you have the plugin installed. */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) {}
    ?>
  </ul>
</div>

It is however worth mentioning that in circumstances that there are no Widgets – the above would output nothing but an empty unordered list.

Comments – Just displays the comments (if set to show), below each post. While there are a lot of bits in here, the main bit can be a touch hidden and is signified by a foreach loop within an Ordered List “commentlist”.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
<ol id="commentlist">
  <?php foreach ($comments as $comment) : ?>
    <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
      <?php echo get_avatar( $comment, 80 ); ?>
      <div class="commentmeta">
        <?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?>
        <?php _e('by'); ?> <?php comment_author_link() ?><?php comment_date() ?>
        @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a>
        <?php edit_comment_link(__("Edit This"), ' |'); ?>
      </div>
      <?php comment_text() ?>
    </li>
  <?php endforeach; ?>
</ol>

Create yourself a screenshot – it’ll make you feel good and will help you recognise the awesomeness that is your style when you are browsing through the hundreds you downloaded that are all tosh when compared with yours!

And that’s your lot.

As I mentioned, I don’t want to replace what is already out there on the web with this guide. In fact, I don’t the word ‘guide’ as it gets me quite excited and I expect something more dramatic than I’ve delivered. I think maybe prefixed with ‘Quick Start’ however, it might become acceptable… Yes. Yes, that seems not to have got my blood pumping!

28th June 2009

Changing Hosting Providers & IIS WordPress

Filed under: Hosting — Tags: , , — Alex Holt @ 10:08 am

There has been half a reason for the absence of articles of late, a change in hosting providers! I appreciate, that’s lousy and actually you’re not interested, nor did you probably even notice I’d been gone – but what the heck, I’m back :)

For years, probably 6, I’ve been with PowWeb who were OK, but as renewal time came around – I was starting to think twice about paying the 2 years up front, when I could limit the period down a little bit. With the credit crunch and all this recession lark – it seemed a logical idea to control my cash flow. So I took a day off work, did a bunch of research and eventually concluded that GoDaddy’s Grid hosting, currently in beta, looked like a good alternative. So I prepared for the move.

I’ve never moved a website before without the support of people who know DNS way better than I do, so this was going to be a bumpy ride. However, making sure that I did as much as I could, I dumped the database, got a zipped up backup of the filesystem and did an extract straight from WordPress and prepared for the inevitable feeling of foreboding.

Things were messy when I realised that to move a domain name, it has to have been at the current provider for more than 60 days. I think when my hosting ran out it was about 55 days. I’m not sure why, nor am I altogether worried by it – but my email stayed working for almost all that five day period, though my website (unpaid) continued for maybe a day (probably due to it expiring on a Sunday). I thought about re-pointing my name-servers for Amadiere.com to GoDaddy’s, but the FAQs weren’t as helpful as they might be – so I gave up pretty promptish and decided I’d have a period of deadness.

The period of inactivity proved useful, as the hosting package I chose included IIS7, PHP5, ASP.NET 3.5, MySQL and MSSQL – so stuff to play around with while I waited. Eventually, everything went well and my site was up and running with my email being down for about 2-3 hours (all said and done, a minor miracle actually). I had a pickle with the Name-Servers on the way, but a quick call to GoDaddy tech support (which I expected to be tosh – but were actually fab, helpful and friendly), that was quickly resolved.

So the move went perfectly?… not quite.

GoDaddy’s hosting isn’t perfect for my liking. You have access only to your webroot, not a folder directly up from your webroot. When I tried to create blog.amadiere.com, this meant I had to create a directory within my webroot for the blog too – something that wasn’t the case at PowWeb. However, the big pickle came when I tried setting up Permalinks on IIS7 and PHP5 for WordPress. Jeez Louise! That’s a mother of a bitch! Basically, saying Permalinks, IIS and GoDaddy Subdomains don’t see eye-to-eye is somewhat an understatement. There is an excellent solution that works for most cases, but it assumes you can set the 404 page for each of your domains – another flaw in the GoDaddy subdomain implementation means your hosting account only has one 404 page – irregardless of the number of (sub) domains you have. I literally couldn’t find an ideal way around this, other than to use my main domain name and drop the blog prefix and add it as a suffix instead.

This means that all my URLs are goosed. Again. I almost feel ashamed that I’ve been here before and yet here I am again. None-the-less, it’s not totally bad. The blog subdomain homepage does still work, but all the links now point to their www counterpart but don’t exist on blog.

The pain suffered through this process is exhausting, but there is light and I’m happy. Hopefully I’ll like GoDaddy and won’t have to do that for at least long enough for me to forget how painful it actually was!…

I think I’m gonna bill the new domain name as a strategic re-branding to harness the dynamic synergy of Web 2.0: http://www.amadiere.com/blog/ ;) I guess it’s time for me to actually brand the site somehow, instead of using all the downloadable themes…

31st May 2009

How To Become A Better Programmer

Filed under: Blogging,Programming — Tags: , — Alex Holt @ 7:23 pm

One of the things that I’ve really begun to do in the last few years is pick up the trail in an attempt to become a great programmer. I am obviously not there, nor do I think I’ll ever get there – but I believe I’m on the right path! Previously to my changing my goals / gaining focus on what I wanted to do, I only got better and more knowledgeable at things that were needed for my job. Now, I’m starting to gain momentum – I can almost *feel* my brain bulging!!

So here are my top tips for becoming a better programmer!

Do Some Homework!

A lot of people are very content with programming for a living, but through sheer code exposure logic – if you do programming at home you are exposed to more code and will therefore become better over a shorter period of time. It’s kinda simple when you think about it. There are a few different ways to do this as far as I see it:

  • Take home some work and refactor that ugly function you created. A task that is too big and time-consuming for too little benefit to warrant a redesign in “works time” – but is pecking at your soul, screaming “I’m your dirty secret!”.
  • Create your own project to work on. Establishing a really good, motivating idea can be a great way to spur you on. It could be something for your own devouring or for a wider market (though, check to see whats out there if the latter).
  • Contribute to Open Source – this is probably one of the better, most light weight solutions you can go for. You’re under no obligation to contribute and at worst you get to look around another persons code that you wouldn’t normally and potentially pick up some interesting methods of achieving something you’ve not thought of.

Syndication, Syndication, Syndication!

Find some good blogs & podcasts and subscribe to them! If you can dig out some of the best bloggers for the technology stack that you’re interested in, you can sometimes get some excellent articles to read on the way into work. It’s important to avoid subscribing to too many blogs – you need to be able to actually read them. Too many would be unproductive and you would not get chance to read them and give them the concentration that they deserve.

As it stands at the moment, the blogs I can recommend are: Coding Horror, Joel On Software, Stack Overflow, Scott Hanselman’s Computer Zen, Jon Skeet Coding Blog, ScottGu’s Blog, you’ve been HAACKED, Elegant Code and of course, shameless plug to mine Blog @ Amadiere.com

I’d also highly recommend listening to a few podcasts when you can, the Stack Overflow podcast is particularly good, but there are plenty of others. So scout around for the ones which focus on your development environment (or are to a degree, fairly generic like the Stack Overflow one).

Care About Your Craft

I’m not saying you have to start hyper-ventalating when someone shows you a demo of some of the stuff in ASP.NET 4, but you should at least be interested in what opportunities it might have to offer you (exclusion, of course, for those that do not use .NET). The mere fact you are reading online blogs about improving your craft implies that you already care enough to read and work out of hours. It’s important I believe to feel for your projects, they should be like children to you. You look after them, care for them, make sure they wash behind their ears and when they are finally of age, you can help them leave home and go and live with their users.

Keep Updated With Changes To Your Development Stack

Things change. Don’t be as they say, a “COBOL Dinosaur”. You should be subscribed to whatever feeds you can that tell you when software and development languages are updated. If the updates aren’t detrimental to your development, go ahead and install them and have a play around with any of the new features that took your fancy. Ride the wave of the future!

Have A Book To Read

It doesn’t have to be a dead tree, but having something you can just work your way through will do no harm. There are a number of great books that people recommend with the top ones being Code Complete and the The Pragmatic Programmer. I quite enjoy language and environment specific books too, such as Professional ASP.NET 3.5, Professional ASP.NET MVC 1.0 and Professional C# 2008.

Write Something!

At the end of the day – don’t procrastinate! Write some code! Get your hands dirty and enjoy the glory that is !le code!

« Newer PostsOlder Posts »

Theme designed & built for Amadiere.com by Alex Holt. Powered by WordPress