HTML select box to download files

Just recently I wanted to have a simple HTML select element where the user should be able to click on a specific option to download a certain file. I came up with a solution that contains some JavaScript and straight forward HTML markup.

The HTML markup consists of a simple HTML select element that triggers a certain JavaScript function via the onChange hook. The JavaScript function in turn just sets the window.location to the given file and so the browser starts downloading.

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 →

Remove clutter from WordPress 2.5

After upgrading to WordPress 2.5 I noticed some extra tags in the HTML header of my site: an RSD link, a link to the wlwmanifest.xml and a meta tag with the name set to generator.

While the link tags were introduced in an earlier release of WordPress the meta tag came with 2.5. I’m pretty sure that the latter will cause incompatibilities with a lot of existing themes that have a line like this in their header.php:

<meta name="generator" content="WordPress 2.3.2" />
<!-- leave this for stats please -->

In this post I’d like to share my ideas about removing some clutter from your WordPress installation. Continue reading →