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.
Continue reading...17. June 2008
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.
Continue reading...6. May 2008
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 :
Continue reading...4. May 2008
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.
Continue reading...26. April 2008
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.
Continue reading...17. April 2008
With the CakePHP FormHelper, you can output a set or a list of radio button widgets.
Continue reading...28. February 2008
Due to the way that CakePHP rewrites URL requests with its router, it might seem confusing to execute a Crontab to run a controller action. I will show you how to set up a cron dispatcher so that you can execute all your different controller action schedules on a single file and pass the controller [...]
Continue reading...26. February 2008
I was working on a WordPress plugin today and came across the most disturbing PHP warning error which I have never seen before in all the time that I’ve worked with PHP. The warning error message was : Warning: Cannot use a scalar value as an array What caused this error was when I tried [...]
Continue reading...1. October 2007
I thought that some of you might find it useful to learn how to generate a random string or a random number with PHP. I wrote a quick function to use PHP to generate random. See it below : function genRandomString() { $length = 10; $characters = ’0123456789abcdefghijklmnopqrstuvwxyz’; $string [...]
Continue reading...29. September 2007
Getting a file’s extension is essential when working with uploads and other manipulations complying with files. You might have a user uploading a file and you need to rename the file before moving it from the temporary upload directory. In order to do so, you can obtain the file extension and then rename it to [...]
Continue reading...
21. June 2008
34 Comments