From the Blog

Sep
18

Add a mobile bar code to your WordPress blog

Posted by wubbahed on September 18th, 2007 at 4:16 pm

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>

Leave a Reply

2 Responses to Add a mobile bar code to your WordPress blog

  1.  

    |