Tonight a buddy of mine was helping me put together a Frankenrig from spare parts I accumulated over the weekend. I’d looked something up and he came over to look at pictures of it and said to me “Turn up the google”, and I immediately knew he meant “brightness”.
Fredericton Tweets
I recently worked on a fun little project integrating the Google Maps API with Twitter feeds in order to showcase tweets from business owners in downtown Fredericton, NB (who knew Fredericton had a downtown? ;). The mashup can be found at frederictontweets.com.
Nothing too earth shattering here, but I love working with the Google Maps API. Really powerful stuff.
PHP Simple HTML DOM Parser

I discovered this little beauty awhile ago, but used it once then forgot about it. I rediscovered it today while working on an awesome WordPress theme framework that I’m developing. However I ran into some issues with it and wanted to document them here for future reference, and to help others avoid the debugging grief I just went through.
Accessing Hyphenated Attributes
The documentation states that to access the attribute of an element, use the arrow operator. This works fine in the example:
// Get a attribute ( If the attribute is non-value attribute (eg. checked, selected...), it will returns true or false) $value = $e->href;
However it doesn’t work so well when the attribute we’re trying to access is data-role or data-inset, for obvious reasons. Turns out there’s an attr[] array that stores these values as well, and is much friendlier for these types of attributes. So to access the data-role attribute we’d just use:
$value = $e->attr['data-role'];
Bug When Adding Attributes
It seems that when we add an attribute that didn’t already exist on the element using the aforementioned attr[] array, it fails to add a leading space. We end up with <uldata-role="listview"data-inset="true">, which isn’t really what we’re looking for. The fix is quite easy. Just add the leading space when you assign the attribute, though doing some sanity checks doesn’t hurt:
if ( ! $ul->attr['data-role'] ) // Add leading space on attribute name $ul->attr[' data-role'] = 'listview'; else $ul->attr['data-role'] = 'listview';
That’s all I’ve discovered so far. I do highly recommend this helper class as it lets you manipulate the DOM quite well. I’m normally not opposed to JavaScript, but most of the things I do these days tend to be fairly JS-heavy, so getting some of this lifting done on the server (and caching it) will definitely help with page load times.
Overriding the Default Search Form
I’m working on building an HTML5 WordPress theme that I’ll use as a foundation for all my projects. I’m sort of taking the shoot-first, ask-questions-later approach. That is, I’m using as much HTML5 goodness as I can, and I’ll deal with backwards compatibility later. So, I wanted to use a proper HTML5 search input.
In order to override the default search form, all you have to do is create a file called searchform.php in the root of your theme’s directory. WordPress will pick this up and use it. For reference, my form looks like this:
<form role="search" method="get" id="searchform" action="<?php bloginfo( 'wpurl' ); ?>"> <div> <input type="search" value="" name="s" id="s" results="5" autosave="gg_search" placeholder="Search..." /> <input type="submit" id="searchsubmit" value="Search" /> </div> </form>
audio thai Released!
audio thai has finally been released!
From the audio thai website:
How can audio thai help me learn Thai?
Phonetic systems don’t really work when learning Thai as many sounds in the Thai language don’t exist in English.
audio thai has been designed to allow you to learn Thai, increase your vocabulary and improve your pronunciation by listening to audio files of native Thai speakers.
Only by listening to the audio can you fully understand and learn the true sound, length and tone of the word or syllable.
audio thai is intuitive and easy to use!
- Over 10,000 words and sentences and growing . . .
- Full Thai audio playback for every record.
- Open multiple pop-up windows + multiple copies of audio thai.
- Create and manage your own favourites library.
- Get you started lesson plans.
- A comprehensive categories and classifiers menu.
- Grammar simply explained with examples + alphabet.
- Graphical arrows to help reinforce the correct tone.
- User management and inappropriate content filter for minors.
- Free minor updates.
Happy Canada Day!
Being away from Canada for this long makes me nostalgic. Hope all you Canadians out there are having a blast.
Happy Canada Day everyone!
Displaying HTML5 Elements Correctly with Modernizr
I just figured out how to get this site with all of its HTML5 goodness to display properly* in IE < 9 and FF < 4. It seems that in browsers that support the new elements, they set them to display:block, but in browsers that don’t support them – where Modernizr adds them as a shiv – this property is not set, so must be set manually.
So, without further ado, just add this to the top of your stylesheet:
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display:block;
}
* properly = better. Obviously not “properly” since these browsers still don’t support the CSS3 goodness in use, but at least it doesn’t look like a pile of gecko poo now :)
Get Page ID of Posts Page
Yet another of those “it took me forever to find the answer so I figured I’d post it” posts.
The common answer to the question of “how do I get the ID of the current page?” is
$post->ID
But that fails when the page ID you’re looking for is actually the Posts page. In that case the above statement returns the ID of the first post, not the page itself. Really annoying.
I Hate GoDaddy
I’m working on a client’s WordPress site right now who purchased hosting through GoDaddy. I really can’t think of a positive thing to say about them.
Their web UI is horrendous.
I have to google how to do anything in order to navigate my way around step-by-step, cuz I just don’t know what’s an ad (99% of the site) and what’s actually functional (1% of the site).
Once I actually found the management UI virtually every link I click opens a new tab.
And I just selected to do an automatic WordPress installation (as opposed to uploading the files myself, creating the DB manually, etc.) thinking it would save time, but it sat at Creating Database for about 30 mins.

