How to check which iOS version your device is running
We can check the UIDevice’s property systemVersion for this. Here’s a quick snippet that checks this, and conveniently checks the first number in the returned value. This should work until iOS 9… NSArray *versionArray = [[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."]; if ([[versionArray objectAtIndex:0] intValue] >= 7) { // do this if we're runnign iOS 7 or higher return @"iOS 7 or higher"; } else { // do this if we're running iOS 6 or below return @"iOS 6 or...
read moreHow to fix “Dynamically-related files could not be resolved” message in Dreamweaver
WordPress is made up of over 70 files which may be called to display your site. Dreamweaver has a handy feature with which it lets you discover all those files. Sometimes this works great – and sometimes you get the error message above. I was stumped by this when a site I was working on seemingly threw Dreamweaver overnight. Was was going on? The secret is Permalinks. Dreamweaver has a problem discovering and resolving related files if you’ve set Permalinks to anything other than the default. This problem has been around for a...
read moreHow to remove a widget from the WordPress Dashboard permanently
If you want to never see a widget on your WordPress Dashboard ever again, just head over to the top where it says “Screen Option”, then simply un-tick the ones you don’t like. That’s Zen Therapy right there. These preferences are saved on a per-user basis. But what if you don’t want certain widgets to show up, because your client gets confused by all the dashboard clutter? I know I do! Help is at hand: you can use a couple of neat functions in your theme (or plugin) so certain widgets never even show up....
read moreHow to define Javascript Behaviours in Dreamweaver
Dreamweaver keeps on giving – and the more I’m looking into it, the more I like how it can support me. Today I discovered that you can define Javascript Behaviours without writing a single line of code. This can only be good news – especially if Javascript is one of those things that always looks a bit scary. Here’s how to make Dreamweaver create code that can hide an element, and bring it back. First you’ll have to define a site for this to work. Head over to Site – New Site to do this. All you need to...
read moreHow to change the WordPress Login image and URL
There’s a great little plugin called Add Logo to Admin by c.bavota which does a great job at letting you add your own logo to the WordPress login screen, and even to the top of your dashboard. But it’s another plugin. If you’re building a theme for a client and simply want to replace the generic WordPress image, you can do that with just a few lines of code. Place them in your theme’s functions.php file: //Change the generic login image function custom_login_logo() { echo ”; } add_action(‘login_head’,...
read moreHow to use jQuery in WordPress Themes
On a standalone (non-WordPress) project you’d import the jQuery library in the head tag, then call a jQuery function towards the bottom of your file. This approach isn’t working in WordPress. Since jQuery and many other useful libraries are already part of WordPress, there’s no need to link to your own copy. Instead, you need to “enqueue” such scripts before the closing head tag (and before wp_head() is called). This is done in your theme’s header.php file: wp_enqueue_script(“jquery”); Every...
read moreHow to detect screen width in CSS
Have you ever wondered how a website can look great on your desktop and appear reformatted on your phone? The secret sauce is done via CSS Media Queries. In a nutshell you define your styles for larger screens, and then override those styles with more mobile friendly options if the screen is smaller. You can specify the exact width which allows even to detect if someone is holding their device portrait or landscape. Let’s look at how this can be accomplished with CSS rules. CSS Rules: iPhone & Co. iPhone screens are 320 pixels...
read more