Michael Gunner

Michael Gunner

© 2013 Michael Gunner. All rights reserved.

Author Archives: Michael Gunner

  1. Star ratings for WordPress

    3 Comments

    There are a lot of plugins and various methods for attaching star ratings to WordPress posts – but this is by far the simplest and is great for sites where you review anything, be it music, films, products etc. The first thing you need to do, is setup a custom field for your stars. You don’t need to do anything with code for this, simply go into a post and where the custom fields section is, add a new one giving it the name “starrating”. If there’s no custom fields section, go to screen options and make sure it’s visible.

    Then, give your post a star rating in the value field. For the sake of this article, the star ratings are 1,2,3,4,5. But you could have it up to 10, and if you want half-star ratings you could have 1.5,2.5 etc. Save your post.

    Now we’re going to use the WordPress get_post_meta function to display our stars. The default code for this will simply display the value you entered as text. Of course, we don’t want it to just show up as “4″, we want an image of 4 stars. So the trick is to wrap the code inside an img tag. This then causes the value you entered in the custom field to form part of the img src URL. For example, if you entered a value of 1, the img src would become /images/star1.jpg. A value of 2 would become /images/star2.jpg – and so on. We are essentially using the value of our custom field to alter the img src.

    All you then need to do is create your star images, saving each one with a filename that reflects the rating it’s for. So your 1 star rating image should be called star1.jpg, and so on.

    It’s worth baring in mind if you enter a value into the field that doesn’t exist as an image, then nothing will show up. So if for example, you want to be able to use half-star ratings, you need to create additional images, saving them as “star15″, “star25″ etc. You can’t save your images as “star1.5.jpg” which is why it shows up as 15, so when you enter the value in the custom field you need to enter 15, 25, 35 for a 1.5 star rating, 2.5 star rating, 3.5 star rating etc.

    You should also wrap your code in conditionals, so the website only attempts to display a star rating for posts that are in a particular category, e.g. reviews. You should also save a blank image called star.jpg so that if you don’t attach a star rating to a review, it doesn’t throw up a missing image error. There’s probably some sort of conditional code for WordPress that could handle this but it’s the easiest way.

    You can see a working example here.

  2. Why understanding the moral code of the Victorian era is pivotal to understanding the Titanic tragedy

    Leave a Comment

    All too frequently, when I read articles discussing the famous sinking of the Titanic, comments are made regarding the lifeboats. The typical reaction is of shock that Titanic was equipped with so few boats to cope with a potential disaster. However, when we think like this, we are thinking in line with modern morals, rather than the antiquated moral code that ran deep through the Victorian culture of the time.

    Whilst not directly relevant to web design, morals are an important part of all design and dramatically affect an end result. It’s therefore vitally important when undertaking design work to take into consideration the moral code followed by your users. This can affect things such as words and phrases used, colours, symbolism etc.

    You can read my Critical & Ethical study of the sinking of RMS Titanic here, and understand just how the moral code of the Victorian era played a part.

  3. 1&1 try to blame me for slow website

    1 Comment

    So, I complain to 1&1 a website I host with them has cripplingly slow load times, attaching a Pingdom report which indicates the problem lies with the amount of time the server spends serving the page: Pingdomtest/www.maxumi.co.uk

     

    Their reply is as follows:

     

    Dear Michael (Customer ID: ####),

    Thank you for contacting us.

    We would like to inform you that upon checking the two domain name of yours the “maxumi.co.uk” and “michaelgunner.co.uk” doesn’t have the same content. Your domain name “maxumi.co.uk” contains a slideshow image that will make your website slow compared to the other domain .

    If you have any further questions please do not hesitate to contact us.


    Sincerely,
    Lutze Sumayang
    Technical Support
    1&1 Internet Limited

     

    Now, I know, because I build websites for a living, that this is the biggest load of rubbish I’ve ever read.

     

    First of all, the total size of the page is around 600-950kb. 950kb is not much for a webpage, and it should take no longer than 2 seconds for a decent host to serve a page that size.

    Secondly, the script that runs the slideshow is 30kb. Pretty much neither here nor there, and almost certainly not going to cause a site to run slowly.

    Thirdly, the slider is only on the homepage. So it doesn’t explain why the WordPress back end is also slow, or why other pages on the site are slow too.

     

    I will see what excuse they come up with next, but needless to say, I will be moving the website onto a new host as soon as possible and I would advise anyone to avoid 1&1 at all costs. Their support service is frankly shocking, and the level of ignorance of the support staff is unforgivable.

  4. Use pure CSS for a Polaroid effect

    3 Comments

    So I’m making a holiday landing page and this great suggestion comes up to “Polaroidise” the image. I’m thinking, I could do this in Photoshop.

     

    Or, I could do it using psuedo elements. It was very simple to do in the end, and I especially like the way it rotates on hover.

    Hope you like it too! Feel free to bastardise/use as you wish.

    Grab the code →

  5. A/B testing results speak for themselves

    Leave a Comment

    So, you’re looking to refine a website for conversions. You have two different buttons, or different text, or different CTAs, and you need a simple elegant method of testing each.

    I have been using a tool called phpab and I have nothing but good things to say about it. First of all, set up was a breeze. Download, upload, reference in your php, add the simple tags. Secondly, it automatically integrates into Analytics. You don’t have to do anything, except check a couple of days later to start seeing your variables showing up.

    I also set this up on a WordPress theme and this was just as easy to do. And the results? Well, they speak for themselves really, and the fact that the results are so strong prove that A/B testing is pivotal in web design for driving up conversion rates. Don’t do it and you risk losing out, do it and you have the ability to gain the upper hand and dramatically improve business for the site.

    Do it. Now! Go do some php A/B testing →

  6. In-browser wireframing tool

    Leave a Comment

    This was more an experimentation then anything else, and there are far better, more feature rich, and more fully developed tools out there. However it was fun to make, and I learned a lot about jQuery and the jQuery UI whilst making it..

  7. Use CSS to make any image circular

    3 Comments

    Instead of having to edit every image using Photoshop, this handy CSS snippet can make any image appear circular. It uses border-radius (minus prefixes) so the usual browser support there. You can control what part of the image shows using absolute positioning.

    But wait! You cry, why not just apply border-radius directly to the image? Because that will only work on perfectly square images. If the image is not square, no matter what you do with the border-radius, you’ll never get a circular image. This method works with any image, of any size, of any aspect ratio.

    The trick is to control the width of the image using the inline “width” HTML syntax. This means any image can fit inside the overlay without stretching. Need different sizes? Just create different sized overlays in your CSS.

    I only rustled this up in a few minutes just to see if I could do it. Know a better way? Comment below.

    See code →

    Original Image →

  8. Web Designers who do not design their own site – why this is so wrong

    1 Comment

    This is a common practise that really, really annoys me. You see somebody advertising themselves as a web designer, and when you visit their website you find yourself impressed. It’s smart, slick, beautifully designed. But something doesn’t add up, and on closer inspection you soon discover they are simply using a template. Not only are they using a template, but they haven’t even changed it, not in the slightest.

    There are occasions where templates are OK. If you are primarily a developer, not a designer, and you advertise yourself as such, you may use a template for your website because you don’t design. This is fine, because you’re not selling yourself as a designer, so you’re not misleading anybody.

    But if you are advertising yourself as a web designer, using a template that is not your own work, to sell your work, is deception and dishonesty of the absolute highest level. Here’s a simple analogy. I decide one day I’d like to be an artist. I buy a gallery, and buy a load of Picasso’s, putting them up around the gallery next to signs which advertise myself as an artist. I’m sure you would agree, most people would be pretty pissed off if they then bought a picture off me only to discover that it’s a few scribbles on a page, and it isn’t a Picasso.

    There are occasions where, even as a web designer, you may use a template. A client may not have much to spend and a template is the quickest solution. You may not have time yourself to design your website from scratch. But the important thing here is that you are honest about it. If you use a template, make it clear that you have done so, and make it clear that it is not your work.

    Here is a classic example:

    Web Designers Link

    http://www.yootheme.com/demo/joomla/corona

    As you can see, despite the former link advertising themselves as web designers, their own website is simply a template. Therefore, I feel they are misleading customers into believing their work is better than it likely is.

    The bottom line is, if you are a respectable web designer, your own website should be your own design.