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 !
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="https://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:
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);