Return to site

WP Dev Suite Review – Banking Your Pocket with Software Creation Tool

· WP theme and plugin

Until a few years ago, I hadn't written a single WordPress plugin. I had created and customized many themes for our clients, but for some reason, I kept telling myself that creating a plugin was beyond my capabilities.

In WP Dev Suite Review, I couldn't have been more wrong.

If you've ever felt this way, let me tell you something. Creating a WordPress plugin is not beyond your capabilities. Anyone that has skills enough to write basic PHP and modify a theme can create a plugin.

Why would you want to create a plugin?

If you're like I was, you've probably been adding functionality to your theme instead of creating a plugin. There are plenty of cases where doing so is fine, but there are also cases where custom functionality is better off being added to a plugin. Why might you ask?

Consider this scenario.

You've added functionality to your theme that changes the default gravatar to your own custom gravatar. The only issue is, you've just changed themes and now that's gone. If you had added that code to a plugin it would still be there when you decided to switch themes.

We ran into this issue with the Tabata Times multisite network. They use a handful of themes that need to share custom functionality. How do you think we solved that problem? You guessed it, by adding a good chunk of the functionality into a plugin so it is available to all sites on the network, regardless of which theme they are using.

Create your first plugin in five simple steps

I'm not kidding. You can create a WordPress plugin in five simple steps. Let me show you Snaply Review

1. FTP into your site

The first thing you'll need to do is access your site via FTP using the FTP program of your choice (mine is Coda). If you're not familiar with FTP, I recommend you read up on that before moving forward.

2. Navigate to the WordPress plugins folder

Once you've accessed your site via FTP, you'll need to navigate to the WordPress plugins folder. That folder is almost always located at /wp-content/plugins.

3. Create a new folder for your plugin

Now that you're in the plugins folder it's time to create a folder for yours! Go ahead and create a new folder, giving it a unique name using lowercase letters and dashes such as my-first-plugin. Once you've done that, enter your new folder and move on to the next step.

4. Create the main PHP file for your plugin

Next, you'll need to create the main file for your plugin. To do so, create a PHP file within your new plugin folder and give it the same name such as my-first-plugin.php. After you've done that, open your plugin's main file and get ready to do some editing.

5. Setup your plugin's information

Finally, copy and paste the plugin information below into your main plugin file. Make sure to edit the details such Plugin Name and Plugin URI as they pertain to your plugin.

<?php

/**

* Plugin Name: My First Plugin

* Plugin URI: http://www.mywebsite.com/my-first-plugin

* Description: The very first plugin that I have ever created.

* Version: 1.0

* Author: Your Name

* Author URI: http://www.mywebsite.com

*/

That's it! You've just completed the minimum number of steps that are required to create a WordPress plugin. You can now activate it within the WordPress admin and revel in all of your glory.

What now?

At this point you're probably wondering what this plugin is supposed to do. Well, it doesn't do anything! I said I would show you how to create a plugin, I didn't say I'd show you how to create a plugin that does anything.

All kidding aside, the goal of this GraphySuite Review is to illustrate just how simple it is to get started creating WordPress plugins. Whip one up with the steps outline above and you're ready to start making things happen.

Making your plugin do something simple

Now that you have a plugin, lets make it do something.

The easiest way to make things happen in WordPress is with actions and filters. Let's explore that by creating a simple action that adds a line of text below all of the posts on your site. Copy and paste this code into your main plugin file (below the plugin information) and save it.

add_action( 'the_content', 'my_thank_you_text' );

function my_thank_you_text ( $content ) {

return $content .= '<p>Thank you for reading!</p>';

}

This code hooks into “the_content” action that fires when WordPress renders the post content for your site. When that action fires, WordPress will call our “my_thank_you_text” function that is defined below the “add_action” call.

Going beyond a simple plugin

If you've made it this far, hopefully we're in agreement that creating a simple WordPress plugin is relatively easy. But what if you want to create a plugin that does more than accomplish one simple task?

Actions and Filters

If you're going to start Viral Marketing 2.0 Success Kit PLR Review, I highly suggest you familiarize yourself with how actions and filters work and which ones are available for you to use. The WordPress Codex is where I spend a lot of my time, I suggest you do the same.

WordPress Functions

Again, I spend a lot of my time in the WordPress Codex reading up on core functions as I develop my plugins. There are so many core functions that I wouldn't expect you to know what each and every one of them is and does. That's what the Codex is for after all, so use it!

Creating an Options Page

Finally, if you end up creating a plugin that does something nifty, you'll probably want to create an options page so people that use it can modify the functionality. Creating an options page isn't necessary, there are many plugins that install and do something without one, but having one can be a nice addition for users of your plugin.

Creating an options page is beyond the scope of this post, so once again, I'll leave you in the hands of the WordPress Codex.

If you haven't already, create your first plugin!

Creating WordPress plugins is extremely liberating and a great way to gain a deeper knowledge of how WordPress works. If you haven't already, I strongly urge you try your hand at creating a plugin. If you do and come up with sometime useful, don't forget that you can distribute it freely to others via the WordPress plugin directory.

WordPress plugins are PHP scripts that alter your website. The changes could be anything from the simplest tweak in the header to a more drastic makeover (such as changing how log-ins work, triggering emails to be sent, and much more). This article has been checked and updated on July 5th, 2017.

Whereas themes modify the look of your website, plugins change how it functions. With plugins, you can create custom post types, add new tables to your database to track popular articles, automatically link your contents folder to a “CDN” server such as Amazon S3… you get the picture.

Further Reading on Theme Or Plugin?

If you’ve ever played around with a theme, you’ll know it has a functions.php file, which gives you a lot of power and enables you to build plugin-like functionality into your theme. So, if we have this functions.php file, what’s the point of a plugin? When should we use one, and when should we create our own?

“You must unlearn what you have learned!” Meet the brand new episode of SmashingConf San Francisco with smart front-end tricks and UX techniques. Featuring Yiying Lu, Aarron Draplin, Smashing Yoda, and many others. Tickets now on sale. April 17-18.

Check the speakers →

The line here is blurrier than you might think, and the answer will often depend on your needs. If you just want to modify the default length of your posts’ excerpts, you can safely do it in functions.php. If you want something that lets users message each other and become friends on your website, then a plugin would better suit your needs.

The main difference is that a plugin’s functionality persists regardless of what theme you have enabled, whereas any changes you have made in functions.php will stop working once you switch themes. Also, grouping related functionality into a plugin is often more convenient than leaving a mass of code in functions.php.

Creating Our First PlugIn

To create a plugin, all you need to do is create a folder and then create a single file with one line of content. Navigate to the wp-content/plugins folder, and create a new folder named awesomeplugin. Inside this new folder, create a file named awesomeplugin.php. Open the file in a text editor, and paste the following information in it:

<?php /* Plugin Name: Awesomeness Creator Plugin URI: http://my-awesomeness-emporium.com description: >- a plugin to create awesomeness and spread joy Version: 1.2 Author: Mr. Awesome Author URI: http://mrtotallyawesome.com License: GPL2 */ ?> Copy

Of all this information, only the plugin’s name is required. But if you intend to distribute your plugin, you should add as much data as possible.

With that out of the way, you can go into the back end to activate your plugin. That’s all there is to it! Of course, this plugin doesn’t do anything; but strictly speaking, it is an active, functioning plugin.

Structuring PlugIns

When creating complex functionality, splitting your plugin into multiple files and folders might be easier. The choice is yours, but following a few good tips will make your life easier.

If your plugin focuses on one main class, put that class in the main plugin file, and add one or more separate files for other functionality. If your plugin enhances WordPress’ back end with custom controls, you can create the usual CSS and JavaScript folders to store the appropriate files.

Generally, aim for a balance between layout structure, usability and minimalism. Split your plugin into multiple files as necessary, but don’t go overboard. I find it useful to look at the structure of popular plugins such as WP-PageNavi and Akismet.

http://blueskies.bravesites.com/entries/wp-themes-and-plugins/wp-dev-suite-review

http://guitarprince.postach.io/post/wp-dev-suite-review-banking-your-pocket-with-software-creation-tool

All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OKSubscriptions powered by Strikingly