emGee Software Solutions Custom Database Applications

Share this

Tuts+ Code - Web Development

Updated: 1 day 6 hours ago

14 Best PHP Event Calendar and Booking Scripts

Sat, 04/20/2019 - 02:01

There are several reasons PHP calendar, booking and events scripts might be a great addition to your website. If you’re a service provider, then it makes sense to have an appointment booking system on your site that allows potential customers to see your availability and select an appointment time and date that is best for them. This could cut down on needless calls to your business to make appointments and free up your time or your staff’s time.

Online calendars are also handy for organisations of any size to help team members share events and tasks and keep each other abreast of what other members are working on.

Their usefulness isn’t just limited to companies, however. Artists, writers, performers, bloggers and any other individuals with an active public life could make good use of online calendars to let followers and fans know the whens and wheres of public appearances.

What Type of Script Do You Need?

When it comes to scripts in the event calendar and booking space, choosing the right one can get a little nebulous. They can take dozens of forms, and finding the right one for you can be a daunting task.

To help narrow the solutions down a bit, here are a few questions to ask yourself before you get started:

  • Do I need to focus more on events (a large number of “items” to sell, that occur semi-frequently) or bookings (a smaller number of services that could occur at any time)?
  • Will I need to support only my business? Or are there others that will be included in my listings (for example, a business cooperative)?
  • Will there be a single entity that events/bookings are attributed to (such as an individual contractor), or several (like a hair studio, with several stylists available)
  • Do I need the script to embed into a current site, or do I need something that stands on its own?

With all this in mind, we’ve compiled 14 of our best PHP calendar, booking and events scripts available for download today at CodeCanyon. This post will help you choose the one that’s right for you.

1. Cleanto

Cleanto is ideal for many different types of service companies looking for a reliable way to provide clients with full-featured online booking.

Standout features:

  • PayPal, Authorize.Net, and Stripe payment methods
  • email reminders
  • auto-confirm booking
  • ability to add breaks in schedule
  • and more

User Crossera says:

“Amazing customer support. These guys came back to me within a day with a fix for all the problems I faced. The plugin can be customized to whatever your needs are.”2. Appointo—Booking Management System

An end-to-end solution for booking, Appointo Booking Management System takes the heavy lifting off of your CMS or static site. This script provides a front-end calendar and booking system that can be easily used to mark appointments or events. Then, on the administrative side, you can manage the events and services that are available, and keep track of customers or attendees.

Standout features:

  • front-end booking calendar
  • ability to manage services and booking
  • point of sale support
  • customer management
  • support for both PayPal and Stripe
Appointo's admin dashboard in action

User moffei says:

“Cool and Clean Customer Support. The Superfastest customer support I've ever had on CodeCanyon, plus a better script for the job. I definitely recommend”3. Vacation Rentals Booking Calendar

The Vacation Rentals Booking Calendar is an online vacation rental booking calendar script that allows property owners or management agencies to create and manage rental availability calendars for their vacation rental properties.

Standout features:

  • highly customizable
  • email notifications to site owner or administrator
  • XML and JSON availability feeds
  • export calendars to iCalendar format
  • and more

User Craignic says

“Great product and quick support given when I had a query.”4. SaaSAppoint

A little different from the rest of the scripts on this page, SaaSAppoint allows users to book appointments from multiple businesses in one place. Co-ops, business partnerships, and more can benefit from its directory-style setup and single interface for booking from multiple vendors.

The front-end of the SaaSAppoint booking script

Standout features:

  • multi-business booking support
  • time padding for appointments and blocked-off days
  • discount and coupon code support
  • email and SMS notifications
  • CSV report exporting

User travis-taylor says:

“This product is awesome, and just keeps getting better and better”5. NodAPS Online Booking System

The NodAPS Online Booking System promises to help you manage your appointments more easily. You can create unlimited accounts with administrative, assistant and staff permission, and add unlimited languages to the system. You can also change the booking time and date with a drag-and-drop feature.

Standout features:

  • multi-provider system
  • seven different booking type forms
  • multilingual
  • easy to install
  • and more

User Jam79 says:

“Very simple to use. Fast and effective support!”6. Facebook Events Calendar

A large number of businesses use Facebook as their community hub, posting and sharing most of their events to the platform. Facebook Events Calendar exists to help close the gap between Facebook and your website, letting you embed many of the functions right into your site.

Standout features include:

  • versions for standalone, WordPress, and Joomla platforms
  • display Facebook events directly on your site
  • calendar and list styles
  • several layout options
  • expand event information using a tooltip hover
7. Bookify

Bookify is one of the newest apps at CodeCanyon, but it is already proving to be quite popular with features such as an installation wizard that doesn't require any knowledge of code to use. Bookify also has Google Calendar sync, live chat, and detailed documentation.

Standout features:

  • Stripe and PayPal are supported
  • live chat
  • multi-language support
  • Google Calendar sync
  • and more

User Teatone says:

“Great customer support. Great code quality! If you are looking for something that works with great support, Bookify is the one.”8. Laravel Booking System

The Laravel Booking System with live chat offers a great online system for booking and making appointments. Users can buy credits as a payment option, and view available services, total transactions, their total credits, and administrator contact information via their dashboard.  

From the administrative side, the system administrator can manage all things system related: general settings, payment settings, and user management. Admins can also manage bookings and respond to inquiries from their dashboard.  

Standout features include:

  • live chat
  • multi-language support
  • booking and transaction history
  • PayPal integration
  • and more

User brentxscholl says:

“This plugin works great. Great code. Customer service is fantastic. We asked for extended features and they were delivered for a reasonable price.”9. Tiva Timetable

Fully responsive, easy to set up, and very customizable, the Tiva Timetable is a good choice for those who are looking for a calendar with a clean and simple modern design.

Standout features include:

  • responsive design
  • customisable theme
  • well-documented
  • three layouts available
  • and more

User mandrake62 says:

"Very good script, easy to install. Customer support at the top!"10. Ajax Calendar 2

Ajax Calendar 2 is a highly customisable personal calendar designed to help you keep organised. This is a best-selling update of another popular script, the Ajax Full Featured Calendar.

Standout features:

  • PHP and JS versions with PHP class
  • ability to auto-embed YouTube, Vimeo, Dailymotion, or SoundCloud media
  • ability to export calendar or events to iCal format
  • supports recurring events
  • and more

User sv_fr says:

“Great script. Practical uses. Helpful support.”11. Event Calendar

Built with jQuery FullCalendar and integrated into Bootstrap’s grid layout, the Event Calendar allows users to organise and plan their events.

Standout features:

  • create new types of events
  • ability to add fields such as title, colour, description, link, and photo
  • Google Fonts and Font Awesome Icons
  • and more

User teddyedward  says:

“Really enjoy using your script—it's perfect for my needs. It's also well documented and easy to use.”12. eCalendar

Quite simply, the eCalendar script is designed to keep individual users or companies organised with a calendar that allows users to add as many events as needed, as well as update details like the event title, location, or time.

Standout features:

  • choice of two designs
  • cross-browser compatibility (IE8+, Safari, Opera, Chrome, Firefox)
  • events are saved in your MySQL database
  • fully responsive design
  • and more

User levitschi says:

“Everything works perfectly! Support was better than I ever expected!”13. Event Manager

Event Manager is an online booking system that has the advantage of displaying your events in three forms—calendar view, list view, or map location view using Google Maps.

Conceived for PHP and MySQL, built with the very popular jQuery Full Calendar plugin, and integrated into the Bootstrap grid layout, Event Manager is easy to add to your existing site.

Standout features:

  • fully responsive
  • highly customisable
  • three views available
  • well documented
  • and more
14. BookMySlot

Focusing largely on event bookings, BookMySlot takes it up a notch by allowing for your site to handle multiple vendors, with their individual events nested underneath. This script is thorough and self-contained, so if you are looking for a turnkey solution, rather than something to add to an existing website, this could be the script for you.

Quick list of the features of BookMySlot with demo install

Standout features:

  • thorough documentation
  • separate dashboards for admins and vendors
  • supports Stripe payments
  • built-in messaging system

User aungoo says:

“Outstanding customer support. I'm also happy with the quality of coding. ”Conclusion

These PHP event calendar and booking scripts just scratch the surface of products available at Envato Market. So if none of them catch your fancy, there are plenty of other great options to hold your interest!

And if you want to improve your PHP skills, check out our ever so useful free PHP tutorials.

You might also be interested in our posts about WordPress calendar and booking plugins:

Categories: Web Design

8 Best WordPress Booking and Reservation Plugins

Fri, 04/12/2019 - 13:25

In the digital age, users are online 24/7. Everyone prefers to check availability and make appointments, reservations, or bookings online. They want to do this any time of night and day. This means when your doors close for the day, your business should still be available online. If not, you’re losing business! 

Your website should make it easy for guests to view, reserve, and book available appointments. This is where WordPress booking and reservation plugins can help you meet your online business goals. They help you streamline your online appointments and bookings. Their solutions include basic booking, online calendar integration, payments, and much more. 

So whatever your business—from haircuts to hotels, and from health salons to consulting firms—WordPress booking and reservations plugins will help extend what your business can do.  

A WordPress Plugin for Every Need

One of the great things about WordPress is the huge number of plugins available for adding new functionality to your site. Plugins are specialized pieces of code that add new functionality to your WordPress website. And since plugins are built to carry out very specific functions, they expand what your website can do. 

These plugins can add a minor feature or a whole extensive system. Building this functionality from scratch would be a massive undertaking, requiring a lot of thought, planning, programming, and testing, as well as incorporating user suggestions to improve it and make it efficient. 

The good news is that plugins can save you the worry and the time. There are people and companies that have devoted themselves to making plugins. So if you don’t have coding knowledge, you don’t need to worry. And even if you are a coder, you don't have to spend time creating all your own plugins when there are so many professional-quality plugins available.

WordPress Booking and Reservation Plugins

Think about this for a moment. You run a consumer-oriented website. You want your customers to be able to book appointments on your website any time of day or night. You know that without this you’re losing business. But how do you make your website capable of taking appointments? You need an appointment booking plugin, also known as a booking and reservation plugin.

Also, you may want your customers to be able to make payments for their appointments online. How do you do that? You get a plugin that can integrate with payment gateways like PayPal, Stripe, Square, or Mollie.

Your WordPress website needs a booking form so that guests can view, reserve, or book appointments. You don’t have to build a form from scratch—a booking and reservation plugin enables you to easily add a booking form or booking system to your website. You can integrate a calendar into this plugin, or it may also come with a calendar so your clients can see days and hours available for them to reserve or book appointments.  

As opposed to manual booking systems, booking and reservation plugins allow you automate your booking system, thereby saving you and your customers time. 

Best of all, your data is one place. Decision-making is made easy because you can access all the stats you need from the back-end. 

The one problem is that there are a lot of plugins in the market: tens of thousands. That's why, in this post, I'm going to show you some of the best-quality booking and reservation plugins available in 2019. 

1. Bookly PRO

Bookly Pro WordPress Booking Plugin is super easy to install, even for a WordPress beginner. You’ll be up and running in seconds. It is full-featured, fully customizable, and mobile-ready so customers can book their appointments on the go. It has an easy scheduling process that walks the user from booking to payment in two to six simple steps.  

The inclusion of SMS notifications, online payments, and Google Calendar sync sets it apart from many others.

"Automated online booking & scheduling for WordPress: fully customizable booking form with online payments, notifications, and Google Calendar sync."

Features also included:

  • ability to book different services, with multiple staff members, at different prices
  • translation ready—includes ten languages
  • easy payment integration
  • and more

The Bookly Pro booking plugin is one of the most robust and flexible booking and reservation plugins you'll find.

2. Bookme WordPress Booking Plugin

The Bookme WordPress booking plugin is a multi-purpose booking plugin that cuts away bloated features and delivers a streamlined booking system. It is built with many kinds of businesses in mind. It can be adapted for customer scheduling in beauty salons, patient scheduling health and wellness businesses, training scheduling in gyms and yoga studios, scheduling classes and tutors in education settings, bookings and reservations, and so on. 

Customers can check availability, make appointments, and pay for services with this WordPress booking and reservation plugin.

The booking types include:

  • consultant booking
  • default booking
  • group booking
  • and more

The number of staff members and services is unlimited, the appearance is fully customizable, and it supports custom fields and time slots.

Bookme comes with a powerful admin panel and is user friendly, allowing you to manage all bookings, customers, staff members and more—with just a few clicks. 

The Bookme WordPress Booking Plugin provides all the essential booking and reservation features you want and need, put together in a well-designed package.

3. Webba Booking Plugin

As a service provider, saving time and money while at the same time offering convenient services to your customers is super important. Webba Booking Plugin is built with this in mind. 

First, it’s one of the best-looking WordPress booking and reservation plugins. Secondly, it’s a robust system that has a long list of features to help you customize the appearance of the system in order to express your unique visual and business identity. 

Here are some features to help with customization:

  • 80+ options for appearance customization
  • 79 design presets
  • editable front-end text strings
"Webba Booking is a powerful and easy to use WordPress booking plugin especially thought for service providers to optimize their time and for the comfort of their customers."

To help you properly manage your appointments, features included allow your users to:

  • make multiple reservations in the same session
  • make reservations of several people or services at the same time
  • make online payments with platforms such as PayPal, Stripe, and WooCommerce
  • export CSVs
  • and more

There are many different notification mediums and types, not to mention reminders. So much is customizable, and the Google Calendar support is stellar.

4. Booki—WordPress Booking Calendar

If you want a lightweight and minimalist plugin, Booki is it. It supports both appointment-based and reservation-based bookings. Customers can see bookings in their own time zone. It is integrated with PayPal, has a shopping cart, and can issue discount coupons. It is also integrated with MailChimp. 

The Booki plugin also offers some unique features needed for a satisfying booking experience.

For example, a built-in form builder allows you to create bookings that serve a specific purpose. You can add fields that ask for user input as part of the booking process. 

You can define rules for bookings, for example the number of days that can be booked in a single booking calendar. You can specify a booking period with start and end dates. You can specify prices at the day, hour, or minute level. You can exclude specific days and time slots. 

Not only that, but the system can also adapt to allow single or multiple bookings depending on whether your project is reservation based or appointment based. Costs can be included as a list of checkboxes. You can create an unlimited number of extra features that your customer can check out along with their booking. 

Customer msb1974 has this to say about Booki 

Great value for the price, lets me do exactly what I want, provides a lot of options. Very good documentation. Thanks! This plugin has huge potential!
5. Team Booking 

Use the power of Google Calendar for your bookings and reservations by using the Team Booking system for WordPress. All the availability planning is coordinated via Google Calendar! 

  1. Create “availability” events on Google Calendar.
  2. These events appear on the front-end as open slots for booking.
  3. When the slot is booked, the Google Calendar updates automatically.

This is a highly collaborative workflow. If you’re working as a team, you can let your coworkers plan their own availability from their own Google Calendars.

Other features include:

  • three levels of notification—to the customer, service provider, and admin
  • Google Calendar and Google Maps support 
  • translation-ready
  • approval and cancellation system for both provider and customers
  • customize reservation forms and email notifications

They even provide an API for your custom app.    

Customer Richvds has this to say about the Team Booking Plugin:

Excellent product, well thought out and smartly put together, with the added plus of great support!

6. HBook Hotel Booking System

HBook is a powerful and versatile plugin that is perfectly suited for anybody that owns a business in the hospitality industry: a hotel, B&B, holiday apartment, or campground. It will allow you to easily enable online reservation on your WordPress website. It comes equipped with a customizable booking form with a drag-and-drop form builder that allows you to choose what customer details you want to gather. Shortcode support allows you to add availability calendars, table rates, and booking forms anywhere on your website in seconds.

It has an efficient booking management system with features that include:

  • calendar view to see your bookings at a glance
  • reservation list in a table to view details of all bookings, add comments, change accommodation, update remaining balance, or send emails
  • synchronize your bookings with websites such as Airbnb, Homeaway, VRBO, and Booking.com
  • export your bookings to CSV files
  • integration with multiple payment methods: Stripe, PayPal, Square, Cardlink, Mollie, and more 

Customer contactovisual has this to say:

Simple yet solid hotel booking plugin. I should also mention the excellent documentation and ease of translating for multi-language websites—so important in the hotel business. Good work.

7. Amelia—Enterprise-Level Appointment Booking Amelia is your automated booking specialist, working 24/7 to make sure your customers can make appointments even while you sleep.

Like the other plugins in this list, Amelia lets your customers make appointments any time of day and night. This plugin is easy to customize so you can build your own appointment booking forms. 

Some features include: 

  • supports multiple employees, each with their own services and availability schedule
  • supports multiple business locations
  • step-by-step appointment wizard makes booking easy
  • options to upsell during appointment booking 
  • integration with WooCommerce, PayPal, and Stripe 
  • supports on-site payments so your customers can pay in cash when they arrive

Customer StewartRodgers has this to say:

A really sleek plugin. The development team are super responsive to support and requests, and are continually working on improving it.

Looks like this one has a promising future.

8. Events Calendar Registration and Booking

Do want to promote classes, seminars, workshops, conferences, or concerts on your WordPress website? Do you want to set ticket prices for your events, create recurring events, or even accept donations for your events? If so, Events Calendar Registration and Booking plugin has got you covered. 

With Events Calendar, you can easily create and manage your events online through the WordPress admin interface. Then, visitors will be able to register and pay online for those events via PayPal, Stripe, or Authorize.Net. It gives you a quick glimpse of the latest events created, letting you sort them by categories, view payments, and keep track of your attendees.

Other important features of this plugin include:

  • multilingual 
  • integrated with Google Maps
  • countdown timer
  • confirmation emails
  • shortcode support for calendars and single events

There are many different kinds of WordPress appointment, booking, and reservation plugins available today. Choosing the right one can be crucial to the smooth running of your business. You need to choose a plugin that fits your requirements. While this list is in no way exhaustive, we’ve selected plugins with a solid reputation. All these plugins are available on Envato Market

Did You Find the Plugin You Need?

If a WordPress booking plugin feature you want isn't listed here, you might consider coding your own. Envato Tuts+ has WordPress tutorials, eBooks, and courses. Try WordPress Plugin Development Essentials or maybe the WordPress Hacker's Guide to the Galaxy. Some helpful eBooks include Useful Tricks and Techniques for WordPress and Mastering WordPress.

Categories: Web Design

Best Exit Popups for WordPress Compared

Thu, 03/14/2019 - 15:20

Exit popups are used to encourage your web page visitors to subscribe to an email list, follow you on social media, or complete the purchase in their shopping cart. I'll show you some outstanding popup plugins for WordPress in this post.

Does Your Site Need a WordPress Popup Plugin?

Here are some of the top reasons for having a popup on your site.

1. Grow Your Subscription List 

Popups can be good tools for collecting emails if used properly. You can utilize popups to get people to subscribe to your blog or site if you have a good offering.

2. Convert New Users to Customers

Almost everyone in today's digital age uses an email address, whether for getting the latest news on their popular celebrity blog, sports news, or the latest tips on fashion, beauty, and shopping. Having a large email list will get you closer to your prospective customer.

3. Obtain a Larger Social Following

While some people may not be willing to hand over their email addresses, you can still utilize popups to get people to follow you on social media. Once they follow you, it's easier to keep them engaged. 

4. Reduce Cart Abandonment

Exit popups can also be used to reduce card abandonment in a situation where users are attempting to leave the site without completing a purchase. In this case, you can present a popup that gives them an enticing offer that might change their mind—for example, a discount code, free shipping, or a bonus item with every purchase.

5. Obtain User Feedback

Popups can also be used to better understand your customers by giving them the opportunity to tell you their views.

Best WordPress Exit Popups on CodeCanyon

You too can grow your subscribers and revenue by making use of CodeCanyon's collection of next-level popups. Let's get started.

1. Layered Popups Plugin

The first position in this category goes to Layered Popups, which is very flexible and easy to set up. 

With over 200 templates to choose from and a free constructor for making your own popups in real time, you are only limited by your own imagination. This popup gives you the freedom to choose on which page you want your popups to appear. You can also have different templates for the same purpose. For example, you could create three different contact form designs and test out which converts the best.

The beauty of this plugin is that all the templates are stunning. If you don't have any design expertise, you can just choose any template and just plug it in. Another bonus is that all the templates are fully animated, hence no extraordinary design skills required for a great user experience.

Some of the most stunning features include:

  • Fully compatible with the latest version of WordPress.
  • Mobile friendly: all popups are optimized to fit even the smallest of screens without distracting the user.
  • Layered popups also support over 80 marketing systems, including AWeber, MailChimp, Sendy, and others. These also support most of the popular email verification services.
  • Social share and subscribe: you also have the option of adding social sharing with Facebook and Google platforms to your popups.
  • Built-in ad block detector.
  • Multiple language support: plugins can also be translated into other languages.
  • Remember subscribed visitors: set cookies on the user's machine to avoid repeated popups for already subscribed users.
2. ConvertPlus Popup Plugin

ConvertPlus comes second on our list. It's the perfect popup to turn users into customers. This popup has over 100 ready-made templates to choose from. 

Some of the prominent features of this popup are:   

  • Conversion analytics: this popup gives you the ability to view a real-time graphical analysis of how visitors are interacting with your popups in terms of clicks, unique views, and conversions. This report will help you make informed decisions. 
  • Integration with marketing tools: this plugin also gives you the ability to integrate with your marketing tools in just a few easy clicks.
  • Designs and positions: this plugin comes with the ability to have your popups in different designs and positions. 
  • Multiple triggers: you can also trigger a popup on other conditions, for example when a user is inactive or when they scroll a certain percentage of a page.
3. Slick Modal Popups Plugins

Slick Modal Popups will give you a customized popup for any event or occasion. Whether you just want to showcase your best image collection or show special announcements or notifications, Slick Modal Popups has got you covered.

Slick Modal is the best choice for an eCommerce store. It actually comes with a whole collection of more than 40 different plugins and 60 templates that are tailored to every occasion. It is also bundled with powerful CSS3 animations and various position options.

Other notable features include:

  • Spin wheel plugin: people love free stuff, and one of the coolest things about this collection is that you get a spin wheel template where users can win a gift voucher when they spin the wheel.
  • Showcasing winning products or daily offers: Slick Modal has a product carousel plugin where you can showcase your daily deals to customers.
  • Static banners: static banners are a way to display a small banner of your best product at the side of the page so your users can see it even if they scroll or go to another page.

In conclusion, with Slick Popups, your eCommerce store will definitely stand out.

4. Master Popups

Last but not least, Master Popups is the ultimate email subscription plugin. It features out-of-the-box templates and an all-in-one plugin solution. You can be assured you are getting the best.

Master Popups also features a powerful popup editor and a collection of already-customized templates which allow you to build your own popups in minutes. It will also let you make media-rich popups like YouTube/Vimeo video popups.

Other outstanding components of this plugin are:

  • popup campaigns 
  • integration with popular email marketing services like MailChimp, GetResponse, Mailer Lite, Constant Contact, SendinBlue, and Autopilot 
  • easy-to-create contact forms
  • fully responsive popups even on the smallest mobile devices
  • cookies to remember already-subscribed users
A Word of Warning

As much as popups can be a good way to increase sales and get more email subscriptions, it's also important to strike a balance with how many popups you have and be strategic about them. Users are likely to leave your site if you keep interrupting them with popups.


In this post, we saw some excellent WordPress plugins for creating exit popups. Of course, if you're an online marketer, you'd like your user to stick around the website a little longer. When they attempt to close the web page, you can use an exit popup to offer them a discount that makes them feel special, or invite them to subscribe to your mailing list. 

There are many more WordPress plugins on CodeCanyon. Take a look, and you're sure to find something to make your site sparkle!

Categories: Web Design

11 Best Tab & Accordion WordPress Widgets & Plugins

Mon, 03/04/2019 - 11:47

Sometimes page copy can become a little longer than we expect. When the information is valuable and necessary, it’s tough to cut it down. Fortunately, there’s a way to save vertical real estate on your WordPress site and also reduce information overload for users.

Accordions and tabs are great ways to communicate text-heavy information in an elegant and condensed way. Accordions contain vertically or horizontally stacked panels with just their captions visible. When these panels are clicked, they expand and reveal more information associated with the caption.

Tabs perform a similar function to accordions but in a different way. They are modelled after traditional card tabs inserted in files or card indexes. Like card tabs, tab plugins and widgets are labelled and give clues to the information they conceal. By clicking a tab, a user can reveal more information about the subject of the tab and can use them to navigate through a site or a page.

Whether you’re looking for a tab or accordion widget or plugin (or even a free WordPress theme), you can find what you’re looking for on CodeCanyon. To save you some time, here’s a selection of the 11 best tab and accordion widgets and plugins available on CodeCanyon to get you started.

1. Accordion Slider—Responsive WordPress Plugin

The Accordion Slider plugin combines two great functions in one handy plugin. First it functions as an accordion, and secondly it functions as a slider.

Best features:

  • add as many panels as you want without worrying about screen space
  • touch-enabled to work well with mobile screens  
  • loads images and content from posts, galleries, and Flickr
  • accordions are automatically cached to improve the load time
  • can be placed anywhere: in posts/pages, template PHP code, or widgets

Accordion Slider—Responsive WordPress Plugin is a great two-in-one plugin that will appeal to those looking for a great way to present images or text.

2. Grid Accordion—Responsive WordPress Plugin

One of the best-looking accordions out there, Grid Accordion adds a fresh feel to your site by offering a feature not found in other plugins: an accordion that works in two directions. While most plugins let you open and close tabs or similar UI elements either horizontally or vertically, with this plugin, you can do both. Not only does it handle text content well within its accordion grid, but you can even fill your content areas with images and other media for a more stunning effect.

Make sure to check out the demo for Grid Accordion here.

This plugin also comes with a host of other features, such as:

  • a fully responsive and touch-enabled design
  • support for dynamic content from posts and galleries
  • available hooks for actions and filters
  • JavaScript API endpoints for maximum customisation
3. WP Responsive FAQ with Category

The WP Responsive FAQ with Category plugin is specifically designed for users who have or want to add a Frequently Asked Questions area to their site and don’t want their visitors to have to scroll through an endless stream of text to get to the questions and answers that are relevant to them.

Best features:

  • FAQs can be arranged by category
  • 15 customisable different designs to choose from
  • compatible with Visual Composer page builder and WooCommerce
  • two types of FAQ toggle icons: arrow or plus sign

There’s no question that WP Responsive FAQ with Category is the answer to all your FAQ needs.

4. WooCommerce Category Accordion

The WooCommerce Category Accordion is designed specifically for WooCommerce users. It can be used as a widget or shortcode to list product categories and subcategories.

Best features:

  • supports unlimited categories and subcategories
  • 14 Font Awesome Icons included
  • ability to highlight current category option
  • sort by ascending or descending order

WooCommerce Category Accordion is ideal for users who want to organize their products or services into categories and subcategories to make it easier for customers to navigate their site.

5. Responsive Searchable 3 Level Accordion

Responsive Searchable 3 Level Accordion is a simple plugin that can be used anywhere on your WordPress site. It will appeal to users who are looking to arrange content in accordion style within a post, sidebar, footer, etc.

Best features:

  • can be used as a widget or shortcode
  • three nesting levels available
  • five readymade styling options
  • allows users to type in searched phrase

Responsive Searchable 3 Level Accordion For WordPress is a low-fuss plugin, and its standout features like three-level support and searchable content really set it apart.

6. Accordion FAQ WordPress Plugin

FAQ pages are an important part of almost any website, and with this plugin, you can fit a mountain of text behind a sleek and easily digestible display. This accordion plugin focuses on doing one thing, creating FAQ-style content easily, and it does it well.

Here’s what you can expect to get with this plugin:

  • ability to quickly add multiple FAQ accordions throughout your site
  • easy drag-and-drop interface for reordering
  • colour, icon, and font customisation
  • built-in generator for creating short codes

If you’re looking to add a FAQ section to your existing design, then the Accordion FAQ WordPress Plugin has you covered.

7. WordPress Tabs and Accordions DZS

WordPress Tabs and Accordions DZS is another plugin that gives users access to both tab and accordion functions.

Best features:

  • full skins to fit every brand
  • WYSIWYG editor
  • unlimited colour options for customisation
  • iPhone, iPad and Android optimized
  • and more

So if StackTabs doesn’t appeal, WordPress Tabs and Accordions DZS is another great two-for-one option.

8. Side Tabs—Layered Popups Add-on

A little different than most of the plugins on this list, Side Tabs delivers the features you’d expect from a tab plugin, but instead of existing within your site’s content, they live at the edge of your screen. This unique presentation creates a number of unusual uses.

One of the most interesting ways you can use Side Tabs is to present a constant access point to content throughout an entire page (or several pages). Besides that, it also makes a great tool for offering Calls to Action and similar content without being too intrusive.

With a ton of customisation and animation options available out of the box, this plugin works brilliantly for anyone looking to add a fresh way of presenting information to their site.

9. WooCommerce Tabs Pro: Extra Tabs for Product Page

If you have a WooCommerce site, the WooCommerce Tab Pro plugin will allow you to create and manage 11 different types of tabs to display your products.

Best features:

  • ability to add unlimited tabs to a single product page
  • WYSIWYG editor for editing custom content
  • ability to enable or disable tabs
  • ability to create a global tab that can be used with all products

When you have an eCommerce site, making improvements to your layout can really boost sales. With WooCommerce Tabs Pro: Extra Tabs for Product Page, the tills will soon be ringing.

10. Elegant Tabs for Visual Composer

Elegant Tabs for Visual Composer is an add-on for the WPBakery WordPress plugin (formerly Visual Composer). It lets you add any shortcode to multiple tabs and offers loads of customisation like different colours, icons and backgrounds for different sections or tabs.

Best features:

  • vertical tabs
  • drag and drop any WPBakery elements inside the tab content
  • supports deep linking
  • ten different styles of tabs and unlimited variations
  • and more

Elegant Tabs is also available for Fusion BuilderWooCommerceCornerstone, and Beaver Builder.

11. PullOut Widgets for WordPress

Like the Social Network Tabs for WordPress, the PullOut Widgets is a different take on tabs. It is specifically designed to turn any widget on your site into a pullout tab.

Best features:

  • 289 icons for pullout tabs
  • 32 sliding animation effects
  • unlimited pullout widget positioning on top, right, bottom or left side
  • unlimited widget colours

The most successful websites are interactive, and PullOut Widgets for WordPress gives your visitors plenty of chances to engage with your content.

What Do You Think?

Tell us what you think! Are there any more accordion or tab plugins out there that you like? What projects do you use these plugins for? Let us know in the comments or shoot us an email with your ideas.

These 11 best tab and accordion WordPress widgets and plugins are just a few of the products available at Envato Market. If you haven’t found what you’re looking for here, we have plenty of other great options to fit your needs. So check out the selection of tab and accordion widgets and plugins. And if you want to improve your WordPress skills, check out our ever so useful free WordPress tutorials.

Categories: Web Design

New Course: Practical React Fundamentals

Mon, 02/04/2019 - 07:04

If you want to build dynamic single-page applications quickly and easily, React is a wonderful solution. Learn how to use it—while building your own React app from scratch—in our comprehensive new course, Practical React Fundamentals.

What You’ll Learn

Millions of developers all over the world are beginning to see the power and ease with which you can build front-end web apps with React. So take a little time with Derek Jensen to learn the fundamental concepts that make up React! 

In this course, you'll learn to build a complete web app—a simple hangman clone. 

You'll learn how to create a new app project, build out all the components, handle states and styles, and work with web and lifecycle events. All this, and maybe even have a little fun while doing it!

Watch the Introduction Take the Course

You can take our new course straight away with a subscription to Envato Elements. For a single low monthly fee, you get access not only to this course, but also to our growing library of over 1,000 video courses and industry-leading eBooks on Envato Tuts+. 

Plus you can download unlimited items from the huge Envato Elements library of 890,000 creative assets. Create with unique fonts, photos, graphics and templates, and deliver better projects faster.

Categories: Web Design

20 WordPress Video Plugins and Players to Add Engagement

Thu, 01/31/2019 - 18:26

Video is becoming an increasingly important element of a successful website. It has SEO benefits, increases engagement and the amount of time visitors spend on your site, and will also reflect well on your brand.

WordPress lets you add embedded video out of the box, but you can make the process easier and enhance the quality of users' experience of that video with a plugin.

Here are 20 plugins that will help you add video to your website in 2019.

Lightbox Plugins

Lightbox plugins let you displays images, slideshows and video on top of your screen, making it more vibrant and easier to watch.

1. Lightbox Evolution for WordPress

Lightbox Evolution for WordPress will automatically display all visual media in a lightbox on top of the page content. It greys out the content to make the video pop.


  • display images, HTML content, maps, and videos in a “lightbox” that floats on top of the page
  • multi-browser compatible
  • automatically creates light boxes for new images and video
2. JackBox

Another lightbox plugin you can use to enhance your videos is the JackBox plugin. JackBox works via the post editor and lets you create a lightbox by clicking a button and following a series of steps. No shortcodes to embed and no galleries to work your way through.


  • easy-to-use interface
  • responsive
  • let users share images from your lightbox
  • retina ready
  • group items together to create categories
  • automatic video thumbnail loading
3. Revolution Lightbox

The Revolution Lightbox plugin is another plugin that lets you add video to a lightbox. It also supports images, Google maps and HTML content, giving you maximum flexibility. The lightbox is customizable, so you can adapt it to suit your theme.


  • runs on all major browsers and mobile devices
  • coded for high performance
  • add playlists
  • add links for each lightbox item
  • optional thumbnails and description window
Interactive Video1. iPanorama 360°

With the iPanorama 360° plugin, you can create video walkthroughs with labels and signs. Great for holiday lets or property sales.


  • three scene types: cube, sphere, and cylinder
  • hot spots: allows you to mark different areas that you want to point out
  • virtual tour: travel from one to another scene by clicking on special hotspots
  • tooltip system: the plugin has a built-in powerful tooltip system
  • thumbnails: let people see a quick snapshot of your scene
  • preview image: you can set an image that will show as a preview
  • fullscreen: you can toggle from the normal state to fullscreen and back
  • mouse wheel: zoom with mouse wheel scrolling
  • keyboard: arrows can be used for navigation
Video Automation1. WordPress Video Robot

Manually embedding videos into your site takes time. The WordPress Video Robot plugin automates this process for you. It'll take the search terms you give it and automatically add relevant videos to your site The videos don't even need to be from your own channel.

Additional features:

  • migration tools
  • fully automated
  • no duplicate videos
  • content restriction
2. WordPress Responsive YouTube Playlist Video Player

The WordPress Responsive YouTube Playlist Video Player plugin makes it easy to automatically add videos to your site from individual YouTube playlists. It has features to let you customize the display and the order of play.

Additional features:

  • responsive with intelligent resizing
  • horizontal and vertical layouts
  • customize the interface
  • playlist sources
  • touch-screen support
3. YouTube WordPress Plugin: Video Import

If you want to save time importing video from YouTube, YouTube WordPress Plugin: Video Import can help. In addition to importing video, it uses metadata from YouTube to insert content such as titles, category, tags, and featured image. You can automatically import content from YouTube channels or playlists, saving you time.


  • eliminates repetitive tasks
  • combine multiple YouTube sources
  • automatically import videos
  • bulk video import
4. Facebook Gallery

If you run a Facebook page with lots of video content, then the Facebook Gallery plugin can automatically import that content into your website. It'll take any kind of media including images, video, GIFs, custom effects and more, and turn them into a custom gallery on your site.


  • pull in media from a page or user feed
  • lightbox
  • photo filters
  • social icons for sharing content
  • responsive
Video Galleries1. Essential Grid Gallery WordPress Plugin

With the Essential Grid Gallery WordPress Plugin, you can add photo galleries but also video galleries. Include galleries built with other popular plugins, link to video sites such as YouTube and Vimeo, and create gorgeous grid-based galleries.

Additional features:

  • layout options
  • skins
  • skin editor
  • import/export
  • video tutorials
2. Media Grid: WordPress Responsive Portfolio

The Media Grid: WordPress Responsive Portfolio plugin lets you build bespoke, fully customisable grids of images, video and other media using a simple drag-and-drop interface. It also has a dynamic grid mode, letting you create video grids in moments.


  • visual grid builder
  • dynamic grids
  • fill grids with existing posts
  • lightbox
  • item attributes
3. Video Gallery WordPress Plugin

This plugin is dedicated to video galleries. With the Video Gallery WordPress Plugin, you can link to YouTube, Vimeo and Facebook pages to import video and display it on your site. It's responsive and includes analytics so you can see how many people are watching your videos.

Additional features:

  • self-hosted or streamed video
  • analytics
  • retina ready
  • five skins and skin generator
  • set play from time for each video
4. The Grid: Responsive WordPress Grid Plugin

With The Grid, you can create endless layouts and grids for your videos. It also includes a touch slider (also known as a carousel) for mobile, and WooCommerce support so you can use powerful, responsive video to help sell your products.

Additional features:

  • premium support
  • skin builder
  • custom post type support
  • social stream support
  • touch slider
5. Ultimate Layouts for WPBakery Page Builder

The Ultimate Layouts plugin will help you create a layout for video and other media if you're using the WPBakery page builder plugin.

It's responsive, integrates with YouTube, and lets you build unlimited layouts using the WPBakery page builder, so you don't have to switch to an unfamiliar interface. Display grids, lists, and carousels with ease.


  • 70+ layouts and design builder
  • WooCommerce compatible
  • supports custom post types and custom taxonomies
  • integrates with AdSense for video advertising
6. Final Tiles WordPress Gallery

The Final Tiles plugin is another plugin you can use to create a customisable video gallery in your site. It features two layouts: Final Tiles with mixed image sizes and Masonry with a uniform image size. You can embed videos among your images or create a gallery just from video.


  • mix landscape and portrait images and video with flexible grids
  • seven lightboxes
  • social sharing for each video
  • intuitive admin panel
Video Enhancement and Effects1. Parallax & Video Backgrounds for WPBakery Page Builder

If you use the WPBakery page builder plugin, then Parallax & Video Backgrounds for WPBakery Page Builder will help you make your videos look great.


  • fixed image background
  • vertical & horizontal parallax
  • hover parallax
  • video background
  • multilayer hover parallax 
2. ViralPress

If you want to create and share viral videos that get seen around the world, the ViralPress plugin is for you.

Use it for quizzes, memes, videos, and blog posts. Embed content and make it easy to customize and share the content.


  • create your own Buzzfeed-like site
  • supports BuddyPress
  • allow users to contribute to viral lists
  • allow reactions and comments
3. Elite Video Player

The Elite Video Player plugin is a fully customisable advertising video player that supports advertising and the most popular video channels such as YouTube and Vimeo. 

Import videos, channels or playlists and play using the default YouTube player or add custom controls. As well as YouTube and Vimeo, you can play self-hosted video or video hosted on Dropbox or Amazon S3.


  • advertising pre-roll, mid-roll, or post-roll
  • Google analytics: see which of your videos are most popular
  • sticky mode to keep videos visible
  • lightbox, responsive, and full-screen modes
4. Ultimate Video Player 

If you want to enhance your videos with features such as subtitles in multiple languages, downloads, and adjustable playback speed, the Ultimate Video Player plugin is for you.

It boasts a wide range of features including advertising, cue points, live streaming. and more.


  • advertising pre-roll, mid-roll, post-roll, or via popups
  • links to YouTube and Vimeo
  • stream local video
  • private or password-protected video
  • information windows and subtitle options
5. Flipbook

Ever thought about including videos in a flipbook? The Flipbook plugin lets you do that. Create a dynamic flip book from your content and media, and include video too. Videos will be played overlaid over the flip book in the background.


  • PDF support
  • multiple file upload
  • JavaScript-based and iOS-compatible
  • reverse flip books for right to left languages
  • insert flipbook via shortcode, template or lightbox.
6. HTML5 Video Player

If you're not happy with the default YouTube player, the HTML5 Video Player plugin will provide you with a customisable player that's designed to display your video in high quality. It supports YouTube, Vimeo, and self-hosted video, and it's fully responsive.

Additional features:

  • Google analytics
  • customisable color scheme
  • categories
  • two skins
  • downloading and sharing
Choosing the Right Video Plugin for Your Site

The plugins listed above all do something slightly different, or give a variation on a different functionality such as light boxes or galleries. The best one for your site will depend on your needs: do you want to pull in videos automatically, for example? Are you hosting videos locally? Do you want enhanced video playback controls?

If you check out the plugins listed above, you're sure to find one that's right for your site

Categories: Web Design

Short Course: Better Angular App Architecture With Modules

Mon, 01/21/2019 - 03:22

In all of the holiday rush, maybe you missed a short course we published on the very last day of the year, Better Angular App Architecture With Modules. Learn more about it and watch a free introductory video below.

What You’ll Learn

When you're just starting out with Angular, you'll probably write your app as a single module. This works fine for small apps, but for more complex production apps, the single-module approach will quickly get out of control and make the code hard to maintain.

In this course, Dan Wellman will teach you how to move from a small single-module Angular app to a larger, more complex multi-module architecture. 

Among other things, you'll learn about:

  • adding submodules and feature modules
  • lazy-loading feature modules
  • handling services
  • creating a third-party module

Along the way, you'll see a practical example of how to break an app down into discrete sections in order to minimise and organise the complexity that growth of the codebase brings.

Watch the Introduction Take the Course

You can take our new course straight away with a subscription to Envato Elements. For a single low monthly fee, you get access not only to this course, but also to our growing library of over 1,000 video courses and industry-leading eBooks on Envato Tuts+. 

Plus you now get unlimited downloads from the huge Envato Elements library of 870,000+ creative assets. Create with unique fonts, photos, graphics and templates, and deliver better projects faster.

Categories: Web Design

Preview Our New Course on Angular Material

Wed, 01/09/2019 - 05:50

Angular Material makes it easy to create a great UI for your Angular app. See how it works in our new course, Building App UIs With Angular Material. Keep reading for some free videos from the course.

What You’ll Learn

In this course, Dan Wellman will show you how to use Angular and Angular Material to build rich and interactive UIs for your web apps. You'll learn how to set up the library in a new project and how to use each of the main interface components and layout components. You'll also learn how to create forms and use overlay components such as dialogs and tooltips.

Here are a couple of free lessons from this course, as a preview of what you can expect:

Adding Your First Material Component

In this video, you'll learn how to add your first Material component, which will be the Material sidebar component. This is one of the components that you can generate using the Angular CLI, so it makes sense to start here.

 Material Form Fields

In this video, you'll learn about the Material form field container, which is the basis for creating styled and dynamic form controls using Angular Material.

 Take the Course

You can take our new course straight away with a subscription to Envato Elements. For a single low monthly fee, you get access not only to this course, but also to our growing library of over 1,000 video courses and industry-leading eBooks on Envato Tuts+. 

Plus you now get unlimited downloads from the huge Envato Elements library of 870,000+ creative assets. Create with unique fonts, photos, graphics and templates, and deliver better projects faster.

Categories: Web Design

Build Your Own CAPTCHA and Contact Form in PHP

Tue, 01/08/2019 - 09:11

People write code every day to automate a variety of processes. We exploit the fact that computers are a lot faster and more accurate than humans, which lets us simplify a lot of mundane tasks. Unfortunately, these same abilities can be used to program computers to do something malicious like sending spam or guessing passwords. The focus of this tutorial will be on combating spam.

Let's say you have a website with a contact form to make it easy for visitors to contact you. All they have to do is fill out a form and hit the send button to let you know about a problem or request they have. This is an important feature of a public-facing website, but the process of filling out form values can be automated by malicious users to send a lot of spam your way. This type of spamming technique is not limited to just contact forms. Bots can also be used to fill your forums with spam posts or comments that link to harmful websites.

One way to solve this problem is to devise a test which can distinguish between bots which are trying to spread spam and people who legitimately want to contact you. This is where CAPTCHAs come in. They generally consist of images with a random combination of five or six letters written on a colored background. The idea is that a human will be able to read the text inside the image, but a bot won't. Checking the user-filled CAPTCHA value against the original can help you distinguish bots from humans. CAPTCHA stands for "completely automated public Turing test to tell computers and humans apart".

In this tutorial, we will learn how to create our own CAPTCHAs and then integrate them with the contact form we created in the tutorial.

Creating the CAPTCHA

We will use the PHP GD library to create our CAPTCHA. You can learn more about writing text and drawing shapes with GD in one of my earlier tutorials. We will also have to write a little bit of code to create our random string to be written on the image that's created. Yet another tutorial, titled Generating Random Alphanumeric Strings in PHP, can help us in this regard.

Generate a Random String

All the code from this section will go in the captcha.php file. Let's begin by writing the function to create the random string.

<?php $permitted_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; function generate_string($input, $strength = 5) { $input_length = strlen($input); $random_string = ''; for($i = 0; $i < $strength; $i++) { $random_character = $input[mt_rand(0, $input_length - 1)]; $random_string .= $random_character; } return $random_string; } $string_length = 6; $captcha_string = generate_string($permitted_chars, $string_length); ?>

The $permitted_chars variable stores all the characters that we want to use to generate our CAPTCHA string. We are only using capital letters in the English alphabet to avoid any confusion that might arise due to letters or numbers that might look alike. You can use any set of characters that you like to increase or decrease the difficulty of the CAPTCHA.

Our function creates a five-letter string by default, but you can change that value by passing a different parameter to the generate_string() function.

Render the CAPTCHA Background

Once we have our random string, it's time to write the code to create the background of the CAPTCHA image. The image will be 200 x 50 pixels in size and will use five different colors for the background.

<?php $image = imagecreatetruecolor(200, 50); imageantialias($image, true); $colors = []; $red = rand(125, 175); $green = rand(125, 175); $blue = rand(125, 175); for($i = 0; $i < 5; $i++) { $colors[] = imagecolorallocate($image, $red - 20*$i, $green - 20*$i, $blue - 20*$i); } imagefill($image, 0, 0, $colors[0]); for($i = 0; $i < 10; $i++) { imagesetthickness($image, rand(2, 10)); $rect_color = $colors[rand(1, 4)]; imagerectangle($image, rand(-10, 190), rand(-10, 10), rand(-10, 190), rand(40, 60), $rect_color); } ?>

We begin with random values for the variables $red, $green, and $blue. These values determine the final color of the image background. After that, we run a for loop to create progressively darker shades of the original color. These colors are stored in an array. The lightest color is the first element of our $colors array, and the darkest color is the last element. The lightest color is used to fill the whole background of the image.

In the next step, we use a for loop to draw rectangles at random locations on our original image. The thickness of the rectangles varies between 2 and 10, while the color is chosen randomly from the last four values of our $colors array.

Drawing all these rectangles adds more colors to the background, making it a little harder to distinguish the foreground of the CAPTCHA string from the background of the image.

Your CAPTCHA background should now look similar to the following image.

Render the CAPTCHA String

For the final step, we just have to draw the CAPTCHA string on our background. The color, y-coordinate, and rotation of individual letters is determined randomly to make the CAPTCHA string harder to read.

<?php $black = imagecolorallocate($image, 0, 0, 0); $white = imagecolorallocate($image, 255, 255, 255); $textcolors = [$black, $white]; $fonts = [dirname(__FILE__).'\fonts\Acme.ttf', dirname(__FILE__).'\fonts\Ubuntu.ttf', dirname(__FILE__).'\fonts\Merriweather.ttf', dirname(__FILE__).'\fonts\PlayfairDisplay.ttf']; $string_length = 6; $captcha_string = generate_string($permitted_chars, $string_length); for($i = 0; $i < $string_length; $i++) { $letter_space = 170/$string_length; $initial = 15; imagettftext($image, 20, rand(-15, 15), $initial + $i*$letter_space, rand(20, 40), $textcolors[rand(0, 1)], $fonts[array_rand($fonts)], $captcha_string[$i]); } header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?>

As you can see, I'm using some fonts I downloaded from Google to get variation in the characters. There is a padding of 15 pixels on both sides of the image. The leftover space—170 pixels—is divided equally among all the CAPTCHA letters.

After rendering the text string above the background, your result should look similar to the image below. The characters will be different, but they should be slightly rotated and a mix of black and white.

Adding the CAPTCHA to Our Contact Form

Now that we have created our CAPTCHA, it's time to add it to our contact form. We will use the contact form from my previous tutorial on how to create a PHP contact form and add the CAPTCHA just above the Send Message button.

We will be using sessions to store the CAPTCHA text and then validating the text entered by website visitors. Here is the complete code of our captcha.php file:

<?php session_start(); $permitted_chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; function generate_string($input, $strength = 10) { $input_length = strlen($input); $random_string = ''; for($i = 0; $i < $strength; $i++) { $random_character = $input[mt_rand(0, $input_length - 1)]; $random_string .= $random_character; } return $random_string; } $image = imagecreatetruecolor(200, 50); imageantialias($image, true); $colors = []; $red = rand(125, 175); $green = rand(125, 175); $blue = rand(125, 175); for($i = 0; $i < 5; $i++) { $colors[] = imagecolorallocate($image, $red - 20*$i, $green - 20*$i, $blue - 20*$i); } imagefill($image, 0, 0, $colors[0]); for($i = 0; $i < 10; $i++) { imagesetthickness($image, rand(2, 10)); $line_color = $colors[rand(1, 4)]; imagerectangle($image, rand(-10, 190), rand(-10, 10), rand(-10, 190), rand(40, 60), $line_color); } $black = imagecolorallocate($image, 0, 0, 0); $white = imagecolorallocate($image, 255, 255, 255); $textcolors = [$black, $white]; $fonts = [dirname(__FILE__).'\fonts\Acme.ttf', dirname(__FILE__).'\fonts\Ubuntu.ttf', dirname(__FILE__).'\fonts\Merriweather.ttf', dirname(__FILE__).'\fonts\PlayfairDisplay.ttf']; $string_length = 6; $captcha_string = generate_string($permitted_chars, $string_length); $_SESSION['captcha_text'] = $captcha_string; for($i = 0; $i < $string_length; $i++) { $letter_space = 170/$string_length; $initial = 15; imagettftext($image, 24, rand(-15, 15), $initial + $i*$letter_space, rand(25, 45), $textcolors[rand(0, 1)], $fonts[array_rand($fonts)], $captcha_string[$i]); } header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?>

The fonts that you want to use will go into the fonts directory. Now, you simply have to add the following HTML code above the Send Message button from our previous tutorial on creating a contact form in HTML and PHP.

<div class="elem-group"> <label for="captcha">Please Enter the Captcha Text</label> <img src="captcha.php" alt="CAPTCHA" class="captcha-image"><i class="fas fa-redo refresh-captcha"></i> <br> <input type="text" id="captcha" name="captcha_challenge" pattern="[A-Z]{6}"> </div>

Sometimes, the CAPTCHA text will be hard to read even for humans. In these situations, we want them to be able to ask for a new CAPTCHA in a user-friendly manner. The redo icon above helps us do exactly that. All you have to do is add the JavaScript below on the same page as the HTML for the contact form.

var refreshButton = document.querySelector(".refresh-captcha"); refreshButton.onclick = function() { document.querySelector(".captcha-image").src = 'captcha.php?' + Date.now(); }

After integrating the CAPTCHA in the form and adding a refresh button, you should get a form that looks like the image below.

The final step in our integration of the CAPTCHA we created with the contact form involves checking the CAPTCHA value input by users when filling out the form and matching it with the value stored in the session. Update the contact.php file from the previous tutorial to have the following code.

<?php session_start(); if($_POST) { $visitor_name = ""; $visitor_email = ""; $email_title = ""; $concerned_department = ""; $visitor_message = ""; if(isset($_POST['captcha_challenge']) && $_POST['captcha_challenge'] == $_SESSION['captcha_text']) { if(isset($_POST['visitor_name'])) { $visitor_name = filter_var($_POST['visitor_name'], FILTER_SANITIZE_STRING); } if(isset($_POST['visitor_email'])) { $visitor_email = str_replace(array("\r", "\n", "%0a", "%0d"), '', $_POST['visitor_email']); $visitor_email = filter_var($visitor_email, FILTER_VALIDATE_EMAIL); } if(isset($_POST['email_title'])) { $email_title = filter_var($_POST['email_title'], FILTER_SANITIZE_STRING); } if(isset($_POST['concerned_department'])) { $concerned_department = filter_var($_POST['concerned_department'], FILTER_SANITIZE_STRING); } if(isset($_POST['visitor_message'])) { $visitor_message = htmlspecialchars($_POST['visitor_message']); } if($concerned_department == "billing") { $recipient = "billing@domain.com"; } else if($concerned_department == "marketing") { $recipient = "marketing@domain.com"; } else if($concerned_department == "technical support") { $recipient = "tech.support@domain.com"; } else { $recipient = "contact@domain.com"; } $headers = 'MIME-Version: 1.0' . "\r\n" .'Content-type: text/html; charset=utf-8' . "\r\n" .'From: ' . $visitor_email . "\r\n"; if(mail($recipient, $email_title, $visitor_message, $headers)) { echo '<p>Thank you for contacting us. You will get a reply within 24 hours.</p>'; } else { echo '<p>We are sorry but the email did not go through.</p>'; } } else { echo '<p>You entered an incorrect Captcha.</p>'; } } else { echo '<p>Something went wrong</p>'; } ?>

We updated this file to first check if the CAPTCHA value stored in the session is the same as the value input by the user. If they are different, we simply tell the visitors that they entered an incorrect CAPTCHA. You can handle the situation differently based on what your project needs.

Final Thoughts

In this tutorial, we created our own CAPTCHA in PHP from scratch and integrated it with a PHP contact form we built in one of our earlier tutorials. We also made the CAPTCHA more user-friendly by adding a refresh button so that users get a new string with a new background in case the previous one was unreadable.

You can also use the logic from this tutorial to create a CAPTCHA that relies on solving basic mathematical equations like addition and subtraction. 

If you want to add a CAPTCHA to your website, you should check out some of the form and CAPTCHA plugins available from CodeCanyon. Some of these have CAPTCHA and many other features like a file uploader built in. 

If you have any questions or suggestions, feel free to let me know in the comments. You should also take a look at this list of best PHP contact forms.

Categories: Web Design