Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am having vendor address field for each post using custom field plugin. In single post page.I want to generate bar code.When its scanned by mobile phone.It should display the address of the vendor in text format.

Is there any existing plugin.Or any gold suggestions are appreciated.

Thanks in advance !

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

No need for a plugin if you use the Google Chart tool api its very simple, i have a function that i wrote a while back:

/*
* function to get QR code Image from google chart API
* @Params:
* $content - (string) the content to store inside the QR code (eg: url,address,string..)
* $size - (string) the size of the QR code image , must be in heightxwidth format(eg: 150x150 , 320x320)
* $ImgTag - (bool) if set to true the function will echo out the full img tag of QR code image , 
*           if false then the function will return the image src (default = true)
*/

function get_QR_code($content = null,$size = null,$ImgTag = true){
    if ($size == null){
        $size = '150x150';
    }
    if ($ImgTag){
        echo '<img src="http://chart.apis.google.com/chart?cht=qr&chs='.$size.'&choe=UTF-8&chld=H&chl='.$content .'">';
    }else{
        return 'http://chart.apis.google.com/chart?cht=qr&chs='.$size.'&choe=UTF-8&chld=H&chl='.$content;
    }
}

Usage:

<?php get_QR_code('Hello form Google API'); ?>

which will give you this:

enter image description here

So once you have this function in your theme's functions.php file you can call it in your template and pass the custom field value as the content:

$qr_content = get_post_meta($post->ID,'vendor_address_field_name',true);
get_QR_code($qr_content);
share|improve this answer
    
this is really cool.How can i test it . is it working correctly? Give me suggestions please. –  gowri Jun 27 '11 at 12:28
    
How can you test what? , i know its working, i've used it a lot before. –  Bainternet Jun 27 '11 at 12:38
add comment

http://wordpress.org/extend/plugins/wcs-qr-code-generator/

Seems like a good one. It just uses a shortcode for you to place the bar code wherever you like, the default makes a code for the post url, but you can specify a specific url to your vendor or whatever in the shortcode it looks like.

I haven't tested this, but it seems to be working well for others. I'm not sure if it can be configured to grab the address from the custom field..... but it seems simle enough to add the address for yourself if that is acceptable

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.