Saturday, August 13, 2016

Building a Welcome Page for Your WordPress Product: WP Transients API

When it comes to building a web app with WordPress, its powerful APIs provide a great deal of help. Adding or retrieving any data with the Options API is not a big deal. But sometimes we need to store temporary data with an expiration time.

WordPress offers an intuitive caching via Transients to do just that, i.e. store temporary data with an expiration time. We are going to use transients, so I thought why not take a fresh look at the WordPress Transients API in this article.

According to the WordPress Codex:
The Transients API is very similar to the Options API but with the added feature of an expiration time, which simplifies the process of using the wp_options database table to temporarily store cached information. 
In the scope of this series, transients provide an efficient way for redirecting users to the welcome page when they activate a plugin by storing temporary data.

In this article, we'll explore the concept of the Transients API in WordPress and how it differs from the Options API. So, let's get to it.

Transients API

Transients provide us with ways to temporarily store cached information by providing a custom name (key-value pairs) and an expiration time. Once the defined timeframe is over, the transients expire and get deleted. These transients improve the performance and speed up the overall web app performance.

But a question arises: Is the expiration time the only reason for using the WP Transient API?

The answer is no! Despite the fact that the Options API serves the same purpose of data storage, sanitization and retrieval, it may not provide the best possible performance with large sets of data.

With timeframe being added, transients become the most appropriate way of storing data temporarily. To ensure a lesser number of web queries, transients have the capability to store data in the fast memory, e.g. Memcached, instead of the traditional WordPress database. Also of note is that Transients are inherently sped up by caching plugins, where normal Options are not. As mentioned in the codex:
A Memcached plugin, for example, would make WordPress store transient values in fast memory instead of in the database. For this reason, transients should be used to store any data that is expected to expire, or which can expire at any time. Transients should also never be assumed to be in the database, since they may not be stored there at all.
Therefore, whenever you require a functionality which expires or gets deleted after a particular time span, use transients instead of options. More on that later.

Using Transients

Transients work with an incredibly simple interface. You can perform three basic functions with them:
  • creating/updating a transient via the set_transient() function
  • retrieving a transient via the get_transient() function
  • deleting a transient via the delete_transient() function
These three basic operations can help you speed up web performance.

1. Creating/Updating a Transient
Use the set_transient() function to create or update any transient. The function takes three parameters:
  • Key: (type string) Name of the transient. Must be 172 characters or fewer in length.
  • Value: (type mixed) It's the data which needs to be stored. Can be a PHP variable or an array object.
  • Expiration: (type int) Max time until expiration in seconds. Default 0 (no expiration).
Point to Ponder: The expiration date that you set is the maximum amount of time for which a transient will be stored. After that time, the transient gets deleted. But it can also get deleted before that time. Since it is part of the cache, it can be deleted by the user before that time. So, always think of the expiration time as the maximum amount of time for the life of a transient with only the guarantee that it will be deleted after that.
  1. <?php set_transient( string $transient, mixed $value, int $expiration ) ?>
The first two parameters are the key-value pair and are compulsory, while the third parameter, which defines the maximum time to expire, is optional.

A practical example of calling this function is as follows:
  1. <?php 
  2.     // Transient max age is 60 seconds.
  3.     set_transient( '_welcome_redirect_wpw', true, 60 );
  4. ?>
Time Constants in Transients

In the above example, I added 60 seconds as the third parameter, which defines the expiration time after which the transient gets deleted. According to the above example, the object _welcome_redirect_wpw can only have the max age of 60 seconds.

In WordPress 3.5, several constants were introduced to easily express time. These constants make the code more comprehensive and precise. Here's the list:
  1. MINUTE_IN_SECONDS  = 60 (seconds)
  2. HOUR_IN_SECONDS    = 60 * MINUTE_IN_SECONDS
  3. DAY_IN_SECONDS     = 24 * HOUR_IN_SECONDS
  4. WEEK_IN_SECONDS    = 7 * DAY_IN_SECONDS
  5. YEAR_IN_SECONDS    = 365 * DAY_IN_SECONDS
2. Retrieving a Transient
After storing a value via the set_transient() function, you can retrieve the value by calling the get_transient() function.

It takes a single parameter, the key (i.e. the name) of the transient $transient, and returns the (type mixed) value of the transient.

The standard format is:
  1. <?php get_transient( string $transient ); ?>
In the case of our example, the value is fetched via:
  1. <?php get_transient( '_welcome_redirect_wpw' ); ?>
Pretty simple? But what would happen if the transient does not exist or has expired? If that is the case, then the get_transient() function returns a false value.

I recommend that you use the identity operator (===) when you get the value of a transient to test if it is false or not.

3. Deleting a Transient
There can be situations when you might want to delete the transients before they expire. The delete_transient() function helps you with it. Its format is similar to the get_transient() function.

It takes a single parameter, the key (i.e. the name) of the transient $transient, and deletes the transient permanently.

Here is the general format:
  1. <?php delete_transient( string $transient ); ?>
In our case, we can delete it like this:
  1. <?php
  2.   // Delete the redirect transient.
  3.   delete_transient( '_welcome_redirect_wpw' );
  4.  ?>
The Uses of Transients

Transients can be used to cache anything from the most basic type of data to a complete widget. Since their launch, transients have been utilized in different web projects. Here are a few practical usages of transients:
  • Of course, you can use them in a welcome page of your plugin, which is the scope of this series.
  • You can use them in a sidebar widget which lists data like top blog comments, posts, etc.
  • You can speed up WordPress navigation menus with transients.
  • You can cache a tag cloud with transients.
Conclusion

We're all done with the basics of the WordPress Transients API. In the next two articles, I am going to build a welcome page for a WordPress plugin. I'll put my crude thoughts into something more meaningful and practical.

Finally, you can catch all of my courses and tutorials on my profile page, and you can follow me on my blog and/or reach out on Twitter @mrahmadawais where I write about development workflows in the context of WordPress.
Written by Ahmad Awais

If you found this post interesting, follow and support us.
Suggest for you:

Wordpress Basic to Advanced Tutorials

How To Start A Profitable Wordpress Blog Step By Step 2016

How to Make a Wordpress Website 2016

Thursday, August 11, 2016

Adding Custom Hooks in WordPress: Custom Actions

One of the cornerstones of building custom solutions in WordPress is having an understanding of hooks. In and of themselves, they aren't terribly difficult to understand, and we'll be covering a short primer on them in this tutorial.

But if you're looking to get into more advanced WordPress development, it's worth knowing how to implement your own hooks, as well.

In this two-part series, we're going to review the WordPress hook system and how it's implemented, and we're going to take a look at how to define both our own actions and filters.

Getting Started

Before getting started, this tutorial assumes that you have a local development environment set up that includes the latest copy of WordPress. At the time of this writing, this is WordPress 4.5.2.

If you need guidance on setting up your development environment, please see this tutorial. It will provide you with everything you need to know to get set up with a web server, a copy of PHP, a database, and WordPress.

If you're looking for even more, then the series in which that tutorial is included provides even more information such as how to install WordPress, walkthroughs of themes and plugins, and more.

But in this tutorial, we're focusing on hooks and actions. So once you're all set up, let's get started.

What Are Hooks?

Before taking a close look at WordPress hooks, it's worth understanding the event-driven design pattern (which is also referred to as an event-driven architecture).

If you've worked with existing WordPress hooks or with front-end web development or with JavaScript in any capacity, you're likely familiar with this pattern even if you didn't know it had an official name.

Regardless, this is how it's defined in Wikipedia:
Event-driven architecture (EDA), also known as message-driven architecture, is a software architecture pattern promoting the production, detection, consumption of, and reaction to events.
If you're just now getting started with design patterns or development, this may sound complicated, but another way to think of it is like this:
  • The software has certain points in which it broadcasts a message that something has happened.
  • We, as developers, are able to write code that listens for this message and then respond to it with custom code.
Notice that the definition talks about the production of events, as well. When we move into talking about defining our own hooks, we'll be revisiting this topic. For now, let's look at two events that are common in web development.

Using JavaScript
First, imagine you're working in front-end development. You have a button with the ID attribute of command-button, and when the user clicks on it, you want to display an alert dialog.

Using jQuery, you can implement this functionality like this:
  1. (function( $ ) {
  2.     'use strict';
  3.      
  4.     // jQuery's DOM-ready event-handler
  5.     $(function() {
  6.      
  7.         /**
  8.          * Listen for the 'click' event on the button identified
  9.          * with the 'command-button' ID attribute.
  10.          * 
  11.          * When the user clicks on it, display an alert dialog.
  12.          */
  13.         $( '#command-button' ).bind( 'click', function( evt ) {
  14.             alert( 'You clicked the button.' );
  15.         });
  16.      
  17.     });
  18.  
  19. })( jQuery );
The comments in the code above should explain exactly what's happening. In short, the browser raises an event when the user clicks on a button. When that happens, our code listens for the event and then responds by displaying a dialog.

Of course, other libraries, frameworks, or vanilla JavaScript afford this same functionality. The purpose of showing this within jQuery is because it's one of the most common JavaScript libraries, and because it's also what's bundled with WordPress.

Using WordPress
The implementation of this pattern doesn't necessarily look the same across all programming languages or paradigms. This often depends on the APIs that the framework, foundation, or application provide.

In WordPress, registering our own code with an event that fires is a bit different. For example, let's say that you're working with the administration pages in WordPress and you want to add a new submenu item to the Settings menu. We'll call it Tuts+ Options.

To do this, we'd add the following code to our functions.php file or our plugin or whatever type of project on which we're focused:
  1. <?php
  2.  
  3. add_action( 'admin_menu', 'tutsplus_admin_menu' );
  4. /**
  5.  * Adds a 'Tuts+ Options' submenu to the 'Settings'
  6.  * menu in the WordPress administration menu.
  7.  */
  8. function tutsplus_admin_menu() { 
  9.     add_submenu_page(
  10.         'options-general.php',
  11.         'tutsplus-admin-menu',
  12.         'Tuts+ Options',
  13.         'manage_options',
  14.         'tutsplus-admin-menu-top',
  15.         'tutsplus_admin_options'
  16.     );
  17. }
You can visit the Codex to read more about the admin_menu hook as well as the add_submenu_page function.

This code doesn't add any new functionality to the menu, but it's meant to demonstrate that WordPress provides an admin_menu event, much like a web browser provides a click event. We're then able to inject our own code by defining a function and have it fire whenever that event is raised.

These are two practical examples of the event-driven design pattern being both implemented and used.

Understanding WordPress Actions

Now that we've had a short primer on the event-driven design pattern and seen two implementations of the pattern, let's look specifically at WordPress actions. We'll review what's available and how we can implement our own.

Setting Up Our File
For the purposes of the code in this tutorial, we're going to be using the default twentysixteen theme that ships with WordPress.

In the root of the theme directory, create a file called tutsplus-actions.php. Then, in functions.php, add the following line of code:
  1. <?php
  2. include_once( 'tutsplus-actions.php' );
This instructs the theme to load the file we've defined. The reason we want to do this is so that we can keep our code out of the core of the theme, and so that we can easily remove the code by deleting the include_once statement above.

A Brief Definition of Actions
In WordPress, hooks fall into one of two categories: actions or filters. Actions are points in the WordPress lifecycle that allow you to add, remove, or modify certain functionality. Filters, on the other hand, are points in the WordPress lifecycle in which you can add, remove, or modify data.

In short, actions are intended to work with functionality, and filters are meant to work with data. We'll be focusing on filters more in the second part of this series.

One thing I want to point out is that if you opt to research actions and filters more after reading this series of tutorials (which I encourage), you may find others referring to them more generally as hooks.

Though this is technically correct, it's more pragmatic and it's clearer to discuss the type of hook you're working with whenever you're writing, presenting, or discussing the topic with someone else.

This is because actions are meant to afford one type of functionality, and filters are meant to afford another type of functionality.

Working With Actions
Though we've already looked at a specific example of an action in some example code above, let's take a look at a more complete and more practical example.

Out of the box, WordPress offers two types of posts: Posts (for regular blog posts) and Pages (for static content or content that will rarely change). For a standard blog platform, this type of content is arguably all you need. But WordPress matured into a CMS years ago.

And one of the features that makes WordPress extensible is the ability to introduce our own post types. WordPress calls these custom post types, and they are great when we need to create a type of content that needs its own type of attributes and that needs to be named something more specific than "posts" or "pages".

In order to create our own custom post type, we'll need to do two things:
  1. define a function that hooks into the init hook as provided by WordPress
  2. register our post type with one of the provided API functions
Registering Our Action
To register our action, we'll make use of the add_action function provided by the WordPress API. This tells WordPress that we're introducing an action and that it needs to fire the function identified by the name we've provided in the call to the function.

Our code should look like this:
  1. <?php
  2. add_action( 'init', 'tutsplus_register_post_type' );
In the code above, we're registering a function with the init hook that exists in WordPress. This hook fires early in the WordPress lifecycle and is a good time in which to register a custom post type.

Next, we need to define the function.
  1. <?php
  2. function tutsplus_register_post_type() {   
  3. }
The key to understanding the signature of this function is simple: We've named it tutsplus_register_post_type as that's the second argument we've passed into the add_action call.

This literally instructs WordPress to do the following: During init, make a call to the tutsplus_register_post_type function.

So far, so good. We've not really hit anything complicated, and if you refresh your administration screen of WordPress, then you will see it's still functioning although it isn't doing anything new.

Let's change that.

Creating a Custom Post Type
Now that we have the skeleton code for adding our own action, let's actually make something happen. Specifically, let's create a custom post type called time_traveler that includes a title, an editor, an excerpt, and nothing else.

To do this, we need to review the register_post_type function in the Codex. The documentation gives a solid explanation for all of the arguments that the function can accept, but we're only going to be using a subset of them for our custom post type.

Specifically, we're going to use the following:
  • label
  • labels
  • description
  • public
  • show_ui
  • supports
We'll rely on the rest of the functionality to be provided by the WordPress default values. The arguments will look like this:
  1. <?php
  2.  
  3. $args = array(
  4.     'label'  => 'Time Travelers',
  5.     'labels' => array(
  6.         'name'          => 'Time Travelers',
  7.         'singular_name' => 'Time Traveler',
  8.         'add_new_item'  => 'Add New Traveler',
  9.         'edit_item'     => 'Edit Traveler',
  10.         'new_item'      => 'New Traveler',
  11.         'view_item'     => 'View Traveler',
  12.         'search_items'  => 'Search Travelers',
  13.         'not_found'     => 'No Travelers',
  14.     ),
  15.     'description' => 'A post type used to provide information on Time Travelers.',
  16.     'public'      => true,
  17.     'show_ui'     => true,
  18.     'supports'    => array(
  19.         'title',
  20.         'editor',
  21.         'excerpt',
  22.     ),
  23. );
And the final, full version of the code for registering the post type will look like this:
  1. <?php
  2. add_action( 'init', 'tutsplus_register_post_type' );
  3. function tutsplus_register_post_type() {
  4.   $args = array(
  5.         'label'  => 'Time Travelers',
  6.     'labels' => array(
  7.         'name'          => 'Time Travelers',
  8.         'singular_name' => 'Time Traveler',
  9.         'add_new_item'  => 'Add New Traveler',
  10.         'edit_item'     => 'Edit Traveler',
  11.         'new_item'      => 'New Traveler',
  12.         'view_item'     => 'View Traveler',
  13.         'search_items'  => 'Search Travelers',
  14.         'not_found'     => 'No Travelers',
  15.     ),
  16.     'description' => 'A post type used to provide information on Time Travelers.',
  17.     'public'      => true,
  18.     'show_ui'     => true,
  19.     'supports'    => array(
  20.         'title',
  21.         'editor',
  22.         'excerpt',
  23.     ),
  24.   ); 
  25.   register_post_type( 'time_traveler', $args ); 
  26. }
When you refresh the administration area of your WordPress installation, there should be a new menu item directly under Comments that reads Time Travelers.

When you click on Add New, you should see a place for a title (or the Traveler's name), the editor (for the traveler's information), and an excerpt (perhaps for some notes about the traveler). You should also see a single meta box for publishing the information.


Of course, the above code shows us how to take advantage of existing actions to define a custom post type. But what if we want to create our own actions?

Defining Custom Actions
When it comes to creating our own actions, there are three things that we need to do. At the most fundamental level, we need to do the following:
  1. define the hook
  2. give functionality to the hook
  3. allow developers to call the hook
The simplest example I can give for this is in the following code:
  1. <?php 
  2. /**
  3.  * Define the action and give functionality to the action.
  4.  */
  5.  function tutsplus_action() {
  6.    do_action( 'tutsplus_action' );
  7.  } 
  8.  /**
  9.   * Register the action with WordPress.
  10.   */
  11. add_action( 'tutsplus_action', 'tutsplus_action_example' );
  12. function tutsplus_action_example() {
  13.   echo 'This is a custom action hook.';
  14. }
Feel free to add this example code to tutsplus-actions.php so that you continue to tweak and explore the code after this tutorial.

After that, we can call our function tutsplus_action anywhere in our code. Let's say, for example, we wanted to display it at the top of the administration area. If that's what we wanted to do, then we could add the following code:
  1. <?php 
  2. add_action( 'admin_notices', 'tutsplus_admin_notice' );
  3. function tutsplus_admin_notice() {
  4.   tutsplus_action();
  5. }
If you refresh your dashboard, you'll see "This is a custom action hook" displaying at the top of your dashboard.

Note that I do not recommend hooking into admin_notices unless you're specifically planning to notify the user of a success, warning, or error message. I'm using it here specifically as a way to demonstrate our custom hook.

Revisiting Our Post Type

Let's say we wanted to create a custom post type function that allows us to pass the singular and plural name of the post type into a function through the use of an action hook.

How might we go about doing that? Using what we've seen above, we know the first thing that we need to do is to create a custom function that will call an action. So let's do that now:
  1. <?php
  2.  
  3. function tutsplus_register_custom_post_type() {
  4.  
  5.   // Set the action at priority of 10 and note that it accepts 2 arguments.
  6.   do_action( 'tutsplus_register_custom_post_type', 10, 2 );
  7.  
  8. }
Next, we need to do something that's going to seem a little counterintuitive. Since we want our custom functionality to fire within the context of the init hook, we need to make sure that our hook is fired during the init action.

To do this, we hook our custom hook to the init hook:
  1. <?php
  2. add_action( 'init', 'tutsplus_register_custom_post_type' );
  3. function tutsplus_register_custom_post_type() { 
  4.   // Set the action at priority of 10 and note that it accepts 2 arguments.
  5.   do_action( 'tutsplus_register_custom_post_type', 10, 2 ); 
  6. }
Note in the code above we're specifying two additional parameters for do_action. The first parameter is 10, which indicates the priority in which this hook will fire.

This can be any number where the higher the number, the lower down the list of priorities it will fire. The second parameter is how many arguments the custom hook will accept. In our case, there is one for the singular version of the post type, and there is one for the plural version of the post type.

After that, we need to give functionality to that hook. Here, we'll refactor the code for registering a post type so that it accepts two arguments, and those two arguments will be used in the array passed to WordPress's register_post_type function.
  1. <?php 
  2. function tutsplus_register_post_type( $singular, $plural ) { 
  3.   $args = array(
  4.       'label'  => $plural,
  5.     'labels' => array(
  6.         'name'          => $plural,
  7.         'singular_name' => $singular,
  8.         'add_new_item'  => 'Add New Traveler',
  9.         'edit_item'     => 'Edit Traveler',
  10.         'new_item'      => 'New Traveler',
  11.         'view_item'     => 'View Traveler',
  12.         'search_items'  => 'Search Travelers',
  13.         'not_found'     => 'No Travelers',
  14.     ),
  15.     'description' => 'A post type used to provide information on Time Travelers.',
  16.     'public'      => true,
  17.     'show_ui'     => true,
  18.     'supports'    => array(
  19.         'title',
  20.         'editor',
  21.         'excerpt',
  22.     ),
  23.   ); 
  24.   register_post_type( 'time_traveler', $args ); 
  25. }
Notice here that we've also removed this function from being added to a particular hook. Instead, we'll call it from within the definition of a function that's hooked to our custom action.
  1. <?php
  2. add_action( 'tutsplus_register_custom_post_type', 'tutsplus_register_time_traveler_type' );
  3. function tutsplus_register_time_traveler_type() {
  4.   tutsplus_register_post_type( 'Time Traveler', 'Time Travelers' );
  5. }
In the code above, we're able to make a call to the function responsible for registering the custom post type, all the while passing it our own arguments so that we can add a little bit of custom functionality to the code.

Conclusion

Defining custom hooks isn't complicated, and it also lends a lot of power and flexibility to us as developers. Arguably, the most confusing thing about the code above is how we're defining a hook within the context of another hook (that is, we're defining tutsplus_register_custom_post_type within init).

I've opted to give this as a final example because there are times in which you may want to register a custom hook and it needs to fire before a pre-existing hook is completed.

Registering a hook to stand on its own is easy: You simply don't hook it to a pre-existing hook, and you make a basic function call as we saw with the code hooked to admin_notices.
Written by Tom McFarlin

If you found this post interesting, follow and support us.
Suggest for you:

Wordpress Basic to Advanced Tutorials

How To Start A Profitable Wordpress Blog Step By Step 2016

How to Make a Wordpress Website 2016


Friday, August 5, 2016

20 Useful WordPress WooCommerce Plugins Available on CodeCanyon

1. Fancy Product Designer - WooCommerce Plugin

There are many product printing services on the web whereby users upload images, add text, and create their own unique t-shirt, mug, or just about any other product that can be printed on.

With WooCommerce and the Fancy Product Designer - WooCommerce Plugin, you can do the same thing and build your own custom eCommerce storefront.


This is one of the best online solutions for custom printing businesses:
  • customers can create text layers or upload images—even images from social media accounts
  • customers can color individual layers or choose those set by the store owner
  • smart pricing based on layers, layer types, product types, etc.
  • sell just about any type of product
  • and much, much more!
This HTML5 WordPress WooCommerce plugin works with many themes and is easy to translate.

You can't get much fancier than the Fancy Product Designer - WooCommerce Plugin.

2. WooCommerce Dynamic Pricing & Discounts

This WordPress WooCommerce plugin is a must have for anyone interested in offering discount pricing.

The WooCommerce Dynamic Pricing & Discounts plugin lets you determine pricing rules and cart discounts with ease.

Whether you're selling shippable or digital products, you'll find everything you need:
  • provide quantity discounts, special offers, percentage discounts and more
  • create an almost unlimited number of discount pricing types
  • conditional cart discounts
  • customer loyalty pricing
  • and much more
Start boosting your sales and increasing customer loyalty with the WooCommerce Dynamic Pricing & Discounts.

3. Table Rate Shipping for WooCommerce

For wholesalers and retailers shipping products, you know how complicated shipping can be. Multiply the number of different products with the number of shipping destinations and you'll quickly realize how crazy it can get.

With the Table Rate Shipping for WooCommerce WordPress plugin, however, you can set up a system that will help you charge less for shipping and sell more product.


This WordPress WooCommerce plugin is one of the best-selling WooCommerce extensions for good reason:
  • set up zones based on country, state, or postal codes
  • base rates on price, quantity, weight or dimensions
  • generate one or multiple shipping cost options
  • supports volumetric shipping
  • and much more
The fact that this plugin is also WPML compatible and has a tax inclusion option makes this a stellar choice.

Need to ship? Table Rate Shipping for WooCommerce delivers.

4. WooCommerce Extra Product Options

WooCommerce Extra Product Options is a great solution for eCommerce stores that need to offer extra product options.


This WordPress WooCommerce plugin offers:
  • check-boxes, radio buttons, select boxes, textareas, input boxes, upload, date, range picker, and color picker
  • the ability to replace check-boxes, radio buttons, and select boxes with images
  • hide or show prices
  • form fields builder
  • and more
WooCommerce Extra Product Options is a solid and simple way to bring extra product options to your WooCommerce-powered storefront.

5. WooCommerce Product Filter

If you're selling many products using WooCommerce, you're going to need a good way for customers to search, sort, and find what they're looking for.

A product not found is a sale lost.

The WooCommerce Product Filter is one of the best solutions for searching, sorting, and filtering products.


This WordPress WooCommerce plugin is impressive:
  • filter using taxonomies, price, range, and in-stock filters
  • unlimited filters and easy integration
  • widget filters and filter layouts
  • impressive design options
  • and much more
My favorite feature has to be the filter analytics. Track your customer search behavior to improve your storefront or develop new products.

The WooCommerce Product Filter is one of the best product search filters you'll find.

6. WooCommerce Advanced Shipping

Here's another nice option for those shipping products.

The WooCommerce Advanced Shipping plugin is very advanced, but also easy to use.


Features include:
  • customize with cart, user, and product based conditions
  • volume based pricing and table shipping
  • create unlimited shipping methods
  • set up worldwide shipping zones
  • and more
WooCommerce Advanced Shipping also includes conditional logic.

7. WooCommerce PDF Invoice

Providing a PDF invoice with your eCommerce sales is not only a nice service to the customer, but adds a really professional touch.

The WooCommerce PDF Invoice WordPress plugin is the perfect WooCommerce add-on to do that.


It's hard to consider any other option with these features:
  • supports custom check-fields and multiple custom content blocks
  • offers regular and proforma invoices
  • complies with accounting standards
  • excellent design layout and style
  • automatic invoicing
  • and much, much more
It's feature rich and well designed, and you'd be hard pressed to find anything better.

WooCommerce PDF Invoice is made by professionals, and it shows.

8. WooChimp - WooCommerce MailChimp Integration

Automatically build your customer email list by connecting WooCommerce and MailChimp with WooChimp - WooCommerce MailChimp Integration.

It's pretty nifty.


You'll find just about every option you could ever want in a WooCommerce MailChimp integration WordPress plugin.
  • subscribe customers automatically and sign up on checkout
  • includes widget and shortcode support
  • campaign-to-order tracking
  • Ecommerc360 support
  • and much, much more
Leveraging the power of MailChimp with your WooCommerce storefront extends your reach and marketing in a powerful way.

And you'll “go bananas” over the great support, documentation, and clean code the WooChimp - WooCommerce MailChimp Integration plugin offers.

9. WooCommerce Advanced Bulk Edit

If you want to do bulk editing (or export to a CSV file) of your WooCommerce products, you need to take a look at WooCommerce Advanced Bulk Edit.


Some of the features include:
  • bulk edit, add, and remove attributes
  • create, duplicate, and delete products
  • many ways to filter products
  • supports 40+ fields 
  • and more
WooCommerce Advanced Bulk Edit is simple, straightforward, and gets the job done.

10. Subscriptio - WooCommerce Subscriptions

Subscriptio - WooCommerce Subscriptions gives you everything you need to give your WordPress WooCommerce website the ability to sell and manage subscriptions.


This feature-rich solution is all you'll need:
  • options for cancellation warnings, suspended subscriptions, and more
  • PayPal and Stripe payment gateways are built in
  • recurring payments with any billing cycle
  • set up free trials or set-up fees
  • and much, much more
For magazine subscriptions, online memberships, e-learning packages, etc... there's hardly a better WordPress WooCommerce plugin solution.

Subscriptio - WooCommerce Subscriptions is solid.
Written by Eric Dye

If you found this post interesting, follow and support us.
Suggest for you:

How To Start A Profitable Wordpress Blog Step By Step 2016

How to Make a Wordpress Website 2016

Wednesday, August 3, 2016

What Are WordPress Plugins?

Not long ago, we finished a series on How to Get Started With WordPress and then began this short, two-part series as a follow-up. In the previous article, we took an in-depth look at what WordPress themes are, how to think about them, and where to find them.

But WordPress themes are only half of the market when it comes to searching for solutions to using the application. As we defined in the previous post, WordPress themes are for presentation. This raises the question: What offers functionality?

That's where WordPress plugins come into play.

If you're new to WordPress and have read the previous article and the series prior to that, then you're in a good position to proceed with this article, in which we'll take a deeper look at WordPress plugins.

Note that this article isn't aimed at experienced developers. Instead, we're looking to clarify another aspect of WordPress for those who are just getting started. With that said, let's proceed.

Functionality for Your Site

As we start our discussion on WordPress plugins, it's worth noting there is a fundamental difference between themes and plugins: Themes are for presentation, and plugins are for functionality.

This doesn't mean that plugins can't offer some type of user interface for a front-end element (or elements), but it does mean that a theme shouldn't include a lot of functionality, and there shouldn't be a bulk of, say, templates in a plugin.

But that's my take. What does the WordPress Codex have to say about the matter?
A WordPress Plugin is a program, or a set of one or more functions, written in the PHP scripting language, that adds a specific set of features or services to the WordPress weblog, which can be seamlessly integrated with the weblog using access points and methods provided by the WordPress Plugin Application Program Interface (API).
In my opinion that's a good, clear definition. And it's also a great way to kick off the Codex article that provides you with information on how to start writing your own plugin, so I recommend reading the entire article.

But there's a lot more to WordPress plugins than writing them (and that's beyond the scope of this article, anyway). For example, what should we be expected to pay for a plugin, where can we find plugins, and so on.

How Much Should We Pay for Plugins?
Unfortunately, there's not a clear answer to this. Because plugins come in many different types, there's a wide variety of what you can expect to pay. Some plugins can go for $5 or $9, and some can be several hundred dollars, depending on what they do and who they are attempting to reach.

Some plugins are free, and some are not. Those that aren't free are considered to be premium plugins. Premium plugins may offer a one-time purchase or may require a subscription on a per-month basis, per-year basis, or a per-site basis.

Free Plugins

There are many, many free plugins that are available for WordPress. The best and arguably safest place to find these plugins is in the WordPress Plugin Repository.


They are searchable from within the WordPress dashboard itself or from the Plugin Repository website.

The plugins that you find in the repository will likely offer just about anything you can imagine; however, they may not all be up to date with the current version of WordPress, so it's imperative that you read up on the plugin before installing it.

Furthermore, some of these plugins may not offer support. This means that if you have a problem with the plugin, then you may not be able to get any help with it beyond what's offered in the support forums.

Conversely, some people do provide support for their free plugins. Where they do this varies. Sometimes it's via email, sometimes it's via the built-in support forum in the WordPress Plugin Repository, and sometimes it's through another help-desk solution.

Just as is true when installing WordPress plugins, you will need to read the information on the plugin's homepage before installing it to find out as you can about the plugin, its functionality, and where to get support for it once you've begun using it.

Premium Plugins

Because WordPress is licensed under what's known as the GPL, its derivative works also inherit that license. This means that any of the software that's built on top of WordPress or that extends the software is also freely available. Then again, this is more of a legal issue than a software issue and is beyond the scope of this article.

But this raises a question: How do you purchase WordPress plugins when the source code can be made available for free?

There are a number of ways people monetize their plugins:

  • Some sell support for their WordPress plugins.
  • Some sell licenses and support for a number of different sites.
  • Some sell additional features for their plugins.
  • Some sell add-ons for the core product.
  • And many other models.

The point of this is not to diverge into talking about ways to monetize plugins but to share that there are different ways in which individuals and companies will sell their work and to show you what you can expect.

Where Can We Purchase Plugins?

As is the case with pricing, there's not just a handful of places where you can buy plugins. Sure, there are marketplaces like CodeCanyon, the WordPress Plugin Repository, and many more.



When it comes to purchasing plugins, it's more important to know who you're buying from and what you're buying. Unfortunately, as with many industries, there are some people who attempt to create products for the sake of scamming other people rather than providing a product with any real value.

To that end, it's more important to understand things to look for (or look out for) rather than only sticking with a couple of marketplaces.

Say, for example, you find a plugin that appears to do whatever it is you need for your site but you've been unable to test drive it, you can't seem to find anything else about the vendor online, and the purchase page isn't properly secured using SSL. This is likely not going to be a place where you'd want to purchase a plugin.

On the flip side, if you've been using a free plugin and it offers a premium version or you find a plugin that appears to suit what you need, and it's by someone who gives back to the WordPress community, is easily found online, has a proper store, and has somewhat of a reputation that precedes them, then you're likely safe buying from them.

Of course, neither of these are hard and fast rules. Above all else, it's always acceptable to ask others if they've heard about a given product and whether or not they've used it (and what their experience has been).

Even in the case where a person appears to be reputable at selling products, they may do a poor job at managing their customers, offering support, or keeping their products updated.

Whatever you opt to do, proceed with caution and attempt to pursue the purchase in the wisest way possible.

How Do I Build Plugins?

Building WordPress plugins can be a lot of fun regardless of whether you're looking to get started in programming or you're already a developer who's looking to extend the application.

At the most fundamental level, this shows interest in contributing to the WordPress economy and solving problems for a variety of those who use the application for their websites, their blogs, or their web applications.

As with anything, it has its own learning curve. Through WordPress plugins can be written exclusively with PHP, it's not at all uncommon for them to include additional languages such as:


On top of that, it's also common to see developers using preprocessed languages such as Sass and using libraries such as jQuery.

Building a WordPress plugin can be a daunting task depending on your level of experience and/or the complexity of the problem that you're trying to solve. For example, if you're brand new to writing WordPress plugins, then writing something that's somewhat simple will still be daunting because of the learning curve that comes with building a plugin.

Conversely, if you're more experienced, then the challenge comes in having your work interface with third-party services, following proper conventions, and/or writing them in a maintainable way following the WordPress Coding Standards and so on.

When getting started with anything related to WordPress, the first place you should always look is the WordPress Codex. Case in point: Writing a Plugin. From there, you may be also interested in some of the following resources:


Of course, there are many more articles and videos about this. Nonetheless, those listed provide a great starting point.

Conclusion

As we've mentioned, WordPress themes are ideally meant for presentation, and WordPress plugins are meant for functionality.

It's not uncommon to find themes including functionality in their codebase. But if you're looking to get started with WordPress development in a professional capacity, I highly recommend keeping the concerns of each separate. This will go a long way in making sure that you not only reach a target audience, but also have yourself set up to more easily maintain your projects.

And for those of you who are interested in learning to write WordPress plugins, there's a lot of documentation and open-source code from which you can learn.
Written by Tom McFarlin

If you found this post interesting, please follow and support us.
Suggest for you:

How To Start A Profitable Wordpress Blog Step By Step 2016

How to Make a Wordpress Website 2016