WordPress : Using Javascript libraries with your plugin or theme

When you develop a WordPress plugin or theme, you might want to make use of some of the Javascript libraries distributed with the WordPress package such as Prototype, Scriptaculous and jQuery.

PHP: Date difference in days

You might need to calculate the date difference in days using PHP. You can easily calculate the days difference by using something like the code below.

Hash sign/symbol on the Macbook

I had to get a new notebook yesterday after spilling a cup of green tea on my Macbook pro. I’ve spilled some liquids on it before, but this time the keyboard and trackpad stopped working completely.

PHP : Array to Object

I wrote a quick and simple function which allows you to quickly convert arrays to objects. It allows you to change an array like this :

WordPress : get_pages

The WordPress get_pages function works similar to the get_posts function which fetches posts from the database by criteria. The get_pages function takes different arguments and allows you to take control of parent and child pages as you execute the function.

Embed Quicktime Movie

Embedding a Quicktime movie player into your webpage work similarly to embedding Flash files, making use of the OBJECT, EMBED and PARAM tags inside your HTML code. You can play .MOV, .MP4 and .MPEG files with the embedded Quicktime movie player.

HTML : Option Groups/Sections

Have you ever wanted/needed to create a select drop down menu with options divided into sub-sections or groups with labels? See the screenshot below.

PHP : Strip filename from a URL

Using PHP, you might need to strip the path from a URL, leaving behind just the filename at the end of the URL. You can achieve this with a regular expression pattern of course, but I have a much simpler solution. See the example code below.

iTunes podCast Categories SQL

I am busy writing a podCast plugin for WordPress and figured that it would be most efficient if I created a Category model which will hold all the podCast feed categories which can be specified in the feed specifically for the iTunes store.

JavaScript : Increment & Decrement Variable Values

Using Javascript, you might want to define a variable when a page is loaded and change the value of that specific variable throughout the period of the interaction of the user with the page. You can define a variable in the HEAD section of the page like this :