Generating a QR Code for a WordPress Post or Page
Have you ever wanted to create a Quick Response Code / QR code for a post or page on your WordPress site? Just add this little snippet to the single.php of your WordPress theme at that location, You want, to display QR. To adjust the size of QR images just change the setting 100 × 100.
1 |
<img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=<?php the_permalink(); ?>" alt="QR: <?php the_title(); ?>"/> |
The code can be easily modified to suit your needs..
I have used this code, in case there is no post thumbnail, like in this post. Here is an example of my code.
1 2 3 4 5 6 7 |
<? if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(); }else{ ?> <img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=<?php the_permalink(); ?>" alt="QR: <?php the_title(); ?>" style="float:left; margin-right:10px; margin-bottom:10px;" /> <? } ?> |
Good luck with WordPress development.
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.
Article interesting, took note, Thanks!)
Glad you liked it, further will be even more interesting. You follow )
Let's hope!) Do you have a solution for embedding a Flash player on a website?, but for it to work like in VKontakte. Turn on the radio station and go to the blog, and it plays.
I haven't found it yet, but it's an interesting topic., If I find it, I'll be sure to post it..
Where do you find them? I thought everyone wrote!)
Themselves too, but sometimes when I find good lessons I add them for myself and post them, and sometimes I just post it with a link back to the author. Everything that can be useful for work, it's also an experience.
I completely agree!) If my decision, I will be glad to your lesson.)