WordPress: Add notes to the comment form

Most themes use the comment_form action which can be used to add arbitrary things to the comment form with a plugin. This post presents a simple plugin that uses custom fields to add special notes to this section.

You can download the plugin here, unzip it, upload it to your wp-content/plugins directory and activate it.

Continue reading →

Hot math: twin and sexy prime numbers

Just recently I discovered that there’s something called sexy prime numbers. I read about twin primes but hadn’t heard the other term before. The concept is pretty simple: take a prime number and check whether the next prime minus the first one results in a certain number, e.g. 2 for twin primes or 6 for sexy primes. This post presents a simple solution to calculate arbitrary combinations of prime number pairs, triplets, etc.

The Eclipse project with the code for this post can be downloaded as tar.gz or zip. You can browse the code online here.

Continue reading →

WordPress: Using custom fields to load scripts and styles

If you’re developing a WordPress plugin that depends on JavaScript or CSS you may advice WordPress to include these things for you. It’s as easy as using two functions – wp_enqueue_script and wp_enqueue_style – and your script or style will be embedded into each and every page generated by WordPress.

Most of the time this is a good thing because it’ll be easier for your users to implement the plugin on their sites. It gets really ugly if the theme loads certain scripts by default which are incompatible with the scripts needed by your plugin. And users concerned about performance – e.g. using Yahoo! YSlow or Google’s PageSpeed – may want to include only things that are really needed on a particular page.

This post presents a solution using custom fields that allows the user to tell the plugin when to include scripts and styles. Doing it this way helps the user to manage your plugin because of it’s added flexibility without hacking the code. Newbies trying to circumvent a certain incompatibility and power users tuning their sites to maximum performance both will love this feature of your plugin.

Continue reading →

Choosing a username: real name vs. fake?

There’re a lot of sites trying to help you with the problem of choosing a username wisely. In this post I’d like to put some emphasis on whether you should use your real name or a made up nickname. It all seems to come down to one question: do you want people to instantly identify you by looking at your username?

If you’re thinking about this question in the broader sense – How do you want to manage your online presence? – you’ll have to take various things into account. Although I haven’t got a plan that fits everybody the ideas presented here may help you to come up with a sensible solution.

Continue reading →