Add a mobile bar code to your WordPress blog

September 18th, 2007  |  Published in Development, Mobile  |  2 Comments

For a while now I’ve been using Alex King’s WordPress Mobile Edition theme/plugin to allow users of mobile devices to easily see and read wubbahed.com. But sometimes it can be a pain to type in URLs into your device, so I just added a new bar code in the sidebar of this blog to make it easier for you to automatically view this page on your mobile device.

Writing the code for this was pretty easy and took about two minutes. First I did this in Javascript, so you don’t even need to do any PHP programming with Wordpress. All you have to do is take the URL for the current page:

location.href

and then combine it with your preferred online bar code generator. Then you can just cut and paste that into your template’s sidebar or wherever else you want. Here’s a few samples for you that you can cut and paste.

1. Nokia Mobile Codes

<script type="text/javascript">
var barcodeimg = '<img src="http://mobilecodes.nokia.com/dm?BARCODE=' + escape(location.href) + '&X=0.18&name=&type=link&MODE=TEXT&a=view" alt="" />';
document.write(barcodeimg);
</script>

2. Kaywa Data Matrix

<script type="text/javascript">
var barcodeimg = '<img src="http://datamatrix.kaywa.com/img.php?s=6&d=' + escape(location.href) + '" alt="datamatrix" />';
document.write(barcodeimg);
</script>

3. Kaywa QR Code

<script type="text/javascript">
var barcodeimg = '<img src="http://qrcode.kaywa.com/img.php?s=6&d=' + escape(location.href) + '" alt="qr code" />';
document.write(barcodeimg);
</script>

Responses

  1. Roger says:

    September 19th, 2007 at 7:43 am (#)

    If you also want a mobilized version with your QR Code, you can get that here:
    http://feed2mobile.kaywa.com

  2. biodun says:

    February 9th, 2008 at 9:49 pm (#)

    Thanks. This is really cool.

Leave a Response