I’m a Web Developer, Software Engineer & Part-time Entrepreneur living in the North of Scotland. I’m also a Christian, a husband and a bit of a car fanatic.

I’m best know for creating the world-famous Nivo Slider but I have a raft of other work in my portfolio at Dev7studios.com. To get more of an idea of what I have done in the past you should check out my resume.

Currently I work full time as a Web Developer for ZillaMedia and Orman Clark. We make awesome WordPress themes.

WP Admin Error Handler

Don’t you hate it when you get those ugly errors and warnings in your WordPress admin area (especially when WP_DEBUG is turned on)? Well today I released WP Admin Error Handler to sort that problem.

Without WP Admin Error Handler

With WP Admin Error Handler

WP Admin Error Handler is a WordPress plugin that catches all the errors and warnings and displays them neatly in the admin bar so you can read them at your convenience. You can also visit the Tools > Errors page to see a more in detailed list of the errors and where they are coming from. Hopefully it will allow you to debug your WordPress errors in a more streamlined way without breaking the look of your WordPress admin area.

PHP make_clickable

So you have string that contains URL’s and you want to make them “clickable”. This is simple and it works:

function make_clickable($text)
{
	return preg_replace('@(?])\b(?:(?:https?|ftp|file)://|[a-z]\.)[-A-Z0-9+&#/%=~_|$?!:,.]*[A-Z0-9+&#/%=~_|$]@i', '\0', $text);
}

Supports normal, ftp, file and email URL’s as well as subdomains. Also it doesn’t mess with HTML a tags that already exist in the string.

Chrome vs Firefox CSS Line-Height on Input

Something which tripped me up today, Firefox doesn’t like line-height on inputs. Chrome likes it just fine.

The solution is simple. When setting a line-height on an input, also set a height.
See it in action.

Enable PHP Error Reporting in MAMP

If you use MAMP on OS X and keep getting server errors when you would normally expect to see PHP errors this is due to the fact that, for some reason, PHP error reporting is turned off by default in MAMP. To enable error reporting:

  1. Open up /Applications/MAMP/bin/php/{your PHP version}/conf/php.ini.
  2. Find display_errors = Off (around line 277) and change it to display_errors = On.
  3. Restart MAMP.

Voila! You should now see PHP errors.

Announcing Pico - A stupidly simple, blazing fast, flat file CMS

As a bit of a side project I recently created Pico – stupidly simple, blazing fast, flat file CMS. Pico aims to provide just the right amount of structure for creating relatively simple static sites.

Maybe you fancy a simpler approach to writing a blog, without having to worry about backend administration, security issues etc. Or maybe you simply need to build a static site and don’t want to worry about installing a bulky CMS? Pico may well be for you.

Pico aims to be stupidly simple. To create a blog for instance, you simply need to create a new text file for each post and upload it to your server. Want to put your blog posts under a “category”, simply put them in a sub folder. “Simples”.

So head on over and check out Pico and let me know what you think.

WordPress get_blog_url()

Have you ever needed to find the WordPress blog URL? Using home_url() is fine but what if your Settings > Reading options in WordPress are set to your blog having a static page (usually called “Blog”). You may need to know what the URL of that page is. So here is a quick function I came up with to find it.

if ( !function_exists( 'get_blog_url' ) ) {
    function get_blog_url(){
        if( $posts_page_id = get_option('page_for_posts') ){
            return home_url(get_page_uri($posts_page_id));
        } else {
            return home_url();
        }
    }
}