What are the button indexes in a three-button UIAlertView
The cancel button is always index 0, and all other buttons in the array start at index 1 counting up. For completion, here’s how to create it: - (IBAction)showAlert:(id)sender { // create an alert view with three buttons UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Three Button Alert" message:@"This is an alert view with more than two buttons. Will it work?" delegate:self cancelButtonTitle:@"No Way (0)" otherButtonTitles:@"Perhaps (1)",...
read moreP2 Header Ad – Version 1.1 released
I’ve just released a quick update for my P2 Header Ad plugin for WordPress: http://wordpress.org/plugins/p2-header-ad/ I’ve added a tickbox which allows you do disable the add for logged-in users so the ad will only be shown to visitors. The release is also available on GitHub: https://github.com/versluis/P2-Header-Ad Here’s a quick peek at the admin interface:
read moreHow to use your own random header images in TwentyThirteen
I really wanted to use the new WordPress TwentyThirteen theme over on my other site http://www.versluis.com. But I didn’t like the idea of using the default header images. Since my previous theme had random header images, I thought it would be great to tap into the now built-in function and prepare a child theme that overrides those existing header images with my own. Here’s how I did it: first we’ll create a child theme then we’ll remove the existing header images and add our own images As a final touch I’ve...
read moreHow to remove __MACOSX from zip archives
Creating a ZIP file on your Mac is really easy: select a few files in Finder, right-click on those and select “Compress…”. It’s the equivalent of selecting “Send to ZIP Folder” under Windows. But Mac OSX does something rather bizarre when creating ZIP files: it adds several unnecessary, unwanted and un-called-for files starting with __MACOSX. This drives PC users nuts – and believe me, it drives Mac users nuts too. Thankfully there is a relatively easy way to remove those files. This may not always be...
read moreHow to use a custom font in CSS
Did you know that with CSS 3 you can load custom true type fonts and use them on your website? It’s relatively simple to do too. First you define a new font face with a URL to your file, then you call it just like you would call a pre-defined font. In this example I’m using the Old Typewriter font from http://www.dafont.com/old-typewriter.font. Once unzipped you’ll end up with a standard .ttf file that you can reference like so: @font-face { font-family:”Old-Typewriter”; src:url(Old-Typewriter.ttf); } Now you can...
read moreFantastic CSS Border Radius generator for all browsers…
Fantastic CSS Border Radius generator for all browsers by @jacob Bijani http://border-radius.com/
read moreSuper awesome code generator for WordPress Developers by…
Super awesome code generator for WordPress Developers by Rami Yushuvaev...
read moreHow to change your WordPress URL when installed in a subfolder
Oftentimes people install WordPress in a subdirectory of the main website. One-click installers like to do this. Say your domain is http://example.com, but WordPress lives in http://example.com/wordpress. By default this means that people will have to visit your website at the latter URL. But what if you want your URL to be http://example.com, without that /wordpress at the end? No problem I say – let me talk you through it. It may sound scary, but that’s just because we have to do some tweaks to files we don’t normally...
read moreHow to override a parent function from your Child Theme
When you’re writing a Child Theme you can easily add your own functions to a custom functions.php file. But sometimes you want to replace or remove a function that the original theme provides. Because the Child Theme’s functions.php file is loaded BEFORE the parent’s file, you can’t just define the same function again as it will be overwritten. You also can’t rely on the original theme providing a “pluggable” parent function, as suggested in the WordPress Codex. What you can do however is to remove...
read moreHow to find the directory of your WordPress Theme in PHP
To get the directory of the current theme (or child theme) you can use get_stylesheet_directory_uri(). Here’s how to use it. Let’s assume that your WordPress installation lives in http://demo.com, and that your theme is located in a folder named “my-super-theme”. We can assume then that the full URL that points at http://demo.com/wp-content/themes/my-super-theme/ The URL will of course be different for every user of your theme, so you can’t hard code this. Instead, you can use this handy function:...
read more