It’s a common problem with a dozen different solutions – if you’ve ever needed to add a ‘select all’ checkbox to a form in order to make your users’ lives easier then you’ll have searched for a simple way to do it. If you’re using jQuery here’s a very simple method.
When building a plugin that has its own settings page, it’s often handy to create a link to the settings page straight from the Plugins list – this saves users the time it takes to find where exactly your plugin appears in the admin menu. Here is a simple code snippet that creates the settings link for you – all you need to do is tell it where to go.
I recently had to clean up a database table of user data because it had the same email addresses assigned to multiple users. The first step was putting together a query that pulled only the duplicate email addresses and also told me how many times they occurred – this simple query looked something like this.
In order to minimise the amount of plugins your site uses, here’s a simple function I use to show a post’s featured image in the RSS feed (something WordPress does not do by default).
A quick line of code to ensure that your WordPress content editor will always land on the HTML tab by default. This will ensure that your HTML tags & attributes are never stripped automatically.
When creating web apps, there’s often a need to generate a random password for your users. There are a number of ways to do this, but in needing to do this recently I came up with this very simple function that will generate a password (or other random string) of whatever length you wish.
I recently had to create an interview test for a developer who has good skill in PHP, but is not so experienced when it comes to front-end coding. On the front-end side of things, the job they were interviewing for required decent HTML & CSS knowledge. With that in mind I created a little test to evaluate their skills – I’m posting it here for anyone else who needs something similar.