Did your customers ever complain about email spam comming from your ClassiPress site? Let’s try to make it a bit more difficult for the spammers. In this tutorial we will replace the simple math question under the description with a reCAPTCHA. Of course we don’t touch the core files! We do all our changes in a child theme.
I assume that you have WordPress Classified Ads Theme and your own child theme running. Time to get started:
Create a reCAPTCHA key on the Google reCAPTCHA site. To do so, just enter your domain on that site and let Google create you a key. The result will be this:
Open your ClassiPress admin area, => ClassiPress => Settings => Security (tab) and set the keys in your reCaptcha Settings. Enable reCAPTCHA and save the settings.
Now we need to copy a core file and place it in our child theme folder. I’m talking about the /themes/classipress/includes/sidebar-contact.php. Create a /includes folder in your child themes folder (so it looks like this: /themes/your-childtheme/includes/) and upload a copy of that sidebar-contact.php file into that /includes folder. So now you have this: /themes/your-childtheme/includes/sidebar-contact.php
Now open your /themes/your-childtheme/includes/sidebar-contact.php with your editor and find this part of code (around line 13):
$result = cp_contact_ad_owner_email( $post->ID );
Replace the above code with this one:
Dear visitor. Get reCAPTCHA on your ClassiPress Single Ad Contact Form is a premium article. If you would like to get access to the rest of this article, please pay $ 3.45 USD fee to help me keeping this site alive. After your payment is done you will automatically receive an Email that includes an activation link. Please Note: The activation link is valid for 2 days.