Have you ever wanted to generate a Quick Response code (QR code) for a post or page of your WordPress website? This snippet will render a QR-code for every article.
Add this small snippet to the single.php file of your WordPress theme inside the Loop at the location you wish to display the QR code. To adjust the size of the QR image, just change the following within the
size=100x100. For example, to make a image that is 200px by 200px, change the value to
<img src="http://api.qrserver.com/v1/create-qr-code/?size=100x100&data=<?php the_permalink(); ?>" alt="QR: <?php the_title(); ?>"/>
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: What is a Blog? Blog vs. Website & How Do They Work?