Add a QR Code to every ad in a new tab on widget
With this mod you will create a QR code on every ad as a new tab on widget.
Note: This is a premium article. Downloadable files are payable.
Here is the picture how it will look:
Here you can see it in action. Just open one ad and check the QR code tab on a widget.
How does it work
This mod uses PHP QR code open source generator which you have to download for this mod to work.
When an ad is shown to the customer, a small php script will call this library to generate a QR code. QR codes are saved as a files in a folder and after one day (or the time you specify) they are being regenerated. We could store QR codes indefinitely, but codes include also a price, so if a user changes the price, this won’t be reflected on QR code.
In the script you can set different parameters like:
– size of the code
– type of error correction
– expiry time of the code
– folder where to save codes
– file type to save code
– frame size around the code
Compatibility
This modification was tested with Classipress 3.2.1, 3.3, 3.3.2., 3.3.3, 3.4.x and 3.5.1
Let’s get to work!
Step 1
Create a new folder in a Classipress theme folder called qr.
Folder structure should look like this:
wp-content/themes/classipress/qr
Then download QR code generator and extract the files to this folder.
Now create a new folder called saved in this newly created qr folder. Here the files with codes are going to be saved. If you have problems with creating files, try changing permissions on this folder.
wp-content/themes/classipress/qr/saved
Step 2
In this part you download the main PHP script to handle QR codes.
Download this file and place it in a qr folder that you created.
Step 3
It is recommended to make backup of files before making any changes.
Now open file sidebar-ad.php and do this changes:
Find this code (it’s around line 21):
And add this code after it:
Then go to line 128 and find this code:
<!-- /priceblock3 --> |
and add this after it:
For Classipress version 3.4.1 or lower you should do it like this:
<!-- tab 4 --> |
For Classipress version 3.5.1 you should do it like this:
<!-- tab 4 --> |
Now you should have a new tab on ads with a QR code in it.
Version history
04/14/2014 – 1.0.0 – Initial version
If you find any issues with this tutorial, please be so kind and write a comment. I’ll try to help as much as I can.