This entry is part 13 of 14 in the Plugin Development 101 Series
- Introduction to WordPress Plugin Development 101
- Plugin Development 101 – What Makes a Plugin?
- Plugin Development 101 – General Best Practices
- Plugin Development 101 – An Intro to Filters
- Plugin Development 101 – Intro to Actions
- Plugin Development 101 – Registering a Custom Post Type
- Plugin Development 101 – Intro to Short Codes
- Plugin Development 101 – Intro to Loading Scripts and Styles
- Plugin Development 101 – Introduction to Adding Dashboard Menus
- Plugin Development 101 – Separating Your Plugin into Multiple Files
- Plugin Development 101 – Your First OOP Plugin
- Plugin Development 101 – Dissecting the Featured Comments Plugin
- Plugin Development 101 – Digging Into WordPress Core to Solve a Problem
- Plugin Development 101 – Introduction to extending classes
This episode of Plugin Development 101 uses an existing plugin as an example to illustrate how to discover the solution to a problem when writing a plugin.
For this episode, we’re looking at the Remove Double Click to Edit for Comments plugin. It’s a small plugin I wrote to remove the option in the WordPress comments page to double click on a comment to load the quick edit view.
This is an extremely simple plugin, but it serves as a good example of how a plugin can be used to solve a problem. It also illustrates how digging into WordPress core in order to find out how the feature works can provide valuable insight on how to construct your plugin.
I’ll give you the same thing that Envato got a lot of – when they began putting up “premium only” content in their “regular” blog – with the intent of giving the feedback that they learned the “hard way.”
Readers like, up front, to be able to tell if they want to “click through” or not. We are all a bit judicious with the clicks we “spend” during our often difficult navigation through the web.
To use a title to entice a click through only to present a “sales pitch” (which to a non-subscriber this basically is) can be considered not entirely honest. “Bait and switch” is the term.
Envato solved the negative comments by simply using titles to reflect it’s true nature: “Premium Video: Digging into WP Core To Solve A Problem” — just a suggestion.
“Plugin Development 101” is an entire tutorial series that teaches you how to write advanced plugins. I don’t think there’s any reason I need to apologize for asking people to pay $6 per month (even just one time) to gain access to several hours worth of tutorial videos that teach how to write plugins.
Should I apologize for not adding “Premium” in the title? No, I certainly don’t think so. Truth is, putting “premium” in the title will drastically reduce the number of people that click into it. There are two primary goals of this tutorial series:
1. Teach people how to write plugins
2. Get some compensation for the amount of time I put into producing the videos
In order to reach those two goals, I need as many people to click into the series as possible. Personally I feel it is much better (for everyone) to entice readers with a preview and then reveal that it is premium. That way at least they know what they are missing if they choose to signup. It’s better to know and not bite than to not know at all because you were turned off by a “premium” tag in the title.
Gonna have to agree with Pippin there. There are blogs that just blog and there are blogs that are a business. Everyone needs to be compensated in some way or the other.
Plus: To use a title to entice a click through only to present a βsales pitchβ – That’s pretty much how the internet works, otherwise, Google Adwords would have failed miserably, and it didn’t.
The issue here isn’t with the title, it’s with your mindset. For some reason you have the idea in your head that all tutorials should be free unless stated otherwise via the title.
If everyone was to follow your logic…then amazon should also start adding “Premium or Paid-For” before all their products just to not confuse people.
Great video as always! I always learn something new! Thanks! Worth the money any day of the week.
Glad to hear it!
Just wondering why you bother wasting your time responding to posts like DJ.
It surely can’t be of any real value to yourself or members.
Would be nice to give Dj the same thing he/she/it threatened to give you.
Best to leave them to there “often difficult navigation through the web.”
Because I don’t believe standing up for what I believe in and what I feel strongly about is ever a waste of time.
did you use “WordPress Plugin Boilerplate” to create the plugin tutorial?
No, it’s all written from scratch.
My2Cents:
Your solution to the double click event is kind of odd even though it “works”.
You remove a class from an anchor tag to prevent the double click event from firing. It “works” because the Double Click event fires the a.vim-q click event (you can search the js file for dblclick)
Lets assume that the vim-q class has some styles associated with it. You could get some funny screen results when you double click and your class on the a tag goes away.
I’d recommend replacing your script with:
(function($) {
setTimeout( removeDblClickEvent = function() {
$(‘.column-comment > p’).each( function() {
$( this ).unbind(‘dblclick’);
//console.log(“removed dblclick event”);
});
}, 200);
}(jQuery));
I certainly don’t disagree π In this particular case I was careful to determine if there were styles on the vim-q class and found it was safe to remove.
Thanks for the info. Whenever i try to dig deep into my wordpress site into the core files, i just end up messing things up and what i get is just a site all messed up. Then i revert the changes and it becomes normal again. I think i am not made to do stuff like this π
What kind of changes are you trying to make?
Really liked this video, Pippin – also happy to know that ‘short and sweet’ plugins are ok too! π Thanks for the series!
Hi Pippin,
About OOP,
I am wondering why most of the plugin don’t write the destruct functions?
Where is exactly the object of class created? In server side or client side?
Thanks!
The destruct methods are not required but can be very useful for certain cases.
The object gets created on the server during the client request.
Hey Pippin!
Seems like we’re getting to the end of the series. Coming from a Ruby background, I’m still wrapping my head around PHP and WordPress helper functions. I’ve gone through TeamTreeHouse and Lynda. If I wanna build some complex plugin, should I dive more into
1) JS (and perhaps JavascriptforWP.com) ?
2) PHP with stuff like perhaps Laravel and LaraCast (with Jeffrey Way) ?
or..
3) Just try writing more plugins and learn along the way?
Appreciate your thoughts!
Best answer: all three.
A deeper understanding oh PHP will really help in writing more complex and powerful plugins.
A thorough understanding of JS will be be more and necessary as WordPress transitions to being powered more by JS than PHP.
The best way to learn is to do it, so write a plugin, then write another, and then twenty more. Each time you’ll find yourself getting better and better. Before too long, you will look back at your early plugins and realize how far your development skills have improved in a short time.
Thanks Pippin! π