Want to add a unique QR Code to all WordPress blog posts? QR codes are a great way to let mobile users use QR code readers to visit urls and get custom experiences in a click.
Add QR Code
Use Google Chart API to generate unique QR codes for each WordPress blog post. Simply add the following code in the your single.php file where you want the QR code to appear.
<img src="https://chart.apis.google.com/chart?cht=qr&chs=150x150&chld=L|4&chl=<?php the_permalink(); ?>" width="150" height="150" alt="QR code" />
QR Code Parameters
Here is the break up of the QR code parameters which you can change
http://chart.apis.google.com/chart? – calls the Google Chart API
cht=qr chooses to display the QR code option
&chs=100x100 calls for the 100 px square size
&chld=L|4 – call for default error correction level and margin (in rows). So want more white border around the code, increase the 4
&chl=<?php the_permalink(); ?> call for the permalink of the single post. Use the url you want.
This will add QR codes of size 100px x 100px to your site. You can change the 100 to 200 or whatever pixel size you like as per your blog template. But remember that very small QR codes are difficult to read by many QR code readers.
So for the main page, I can use this
Scan it with your QR code scanner and see if it works.