SlideShare a Scribd company logo
GETTING STARTED WITH
WORDPRESS PLUGIN
DEVELOPMENT
Thomas Vitale | thomasvitale.com | @vitalethomas
WordCamp Torino 2017 | #wctrn
49 479PLUGINS on WordPress.org
2
Getting Started With WordPress Plugin Development
WHAT IS A PLUGIN?
1. INTRODUCTION TO PLUGINS
4
CORE
THEMES PLUGINS
5
WHY PLUGINS?
1. INTRODUCTION TO PLUGINS
6
DON’T TOUCH THE
CORE!
HODOR
Game of Thrones @ Home Box Office, Inc. All Rights Reserved.
7
CORE
THEMES PLUGINS
8
THE PLUGIN
TERRITORY
1. INTRODUCTION TO PLUGINS
9
THE PLUGIN TERRITORY
FUNCTIONS.PHP PLUGINSVS
10
THE MAIN CONCEPTS
2. PLUGIN BASICS
11
THE MAIN CONCEPTS
THE STRUCTURE
12
/wp-content/plugins/
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY
myplugin.php
myplugin/
THE MAIN CONCEPTS
THE HEADER (MYPLUGIN.PHP)
/**
* Plugin Name: My Plugin
* Plugin URI:  https://thomasvitale.com/myplugin
* Description: The awesome plugin for WordPress Community.
* Version:     3.9.4
* Author:      Thomas Vitale
* Author URI:  https://thomasvitale.com
*/
13
PREFIXES!
PREFIXES EVERYWHERE!
BUZZ LIGHTYEAR
14
CORE
THEMES PLUGINS
15
THE MAIN CONCEPTS
WordPress Execution Flow
Custom Function
16
Icons from www.vecteezy.com
Core
THE MAIN CONCEPTS
WordPress Execution Flow
Custom Function
17
Icons from www.vecteezy.com
Core
EVENT-DRIVEN
PROGRAMMING
2. PLUGIN BASICS
18
HOOK
Getting Started With WordPress Plugin Development
Getting Started With WordPress Plugin Development
Getting Started With WordPress Plugin Development
CORE
PLUGINS
23
Icons from www.vecteezy.com
CORE
THEMES PLUGINS
24
ACTIONS
2. PLUGIN BASICS
25
ACTIONS
bob
function tom_ciak() {
// Print a paragraph
echo “<p>And action!</p>”;
}
add_action( ‘bob’, ‘tom_ciak’ );
1
2
26
Icons from www.vecteezy.com
WordPress Execution Flow
ACTIONS
Function1
Function3
Function2
27
Icons from www.vecteezy.com
WordPress Execution Flow
bob
ACTIONS
wp_head
LoadCSS
28
Icons from www.vecteezy.com
WordPress Execution Flow
FILTERS
2. PLUGIN BASICS
29
FILTERS
jack
function tom_adv( $content ) {
return $content .“Follow me!”;
}
add_filter( ‘jack’, ‘tom_adv’ );
1
2
30
Icons from www.vecteezy.com
WordPress Flow Execution
FILTERS
the_content
Function
31
Icons from www.vecteezy.com
WordPress Flow Execution
AN EXAMPLE
3. DEMO
32
Getting Started With WordPress Plugin Development
AN EXAMPLE
TOM BANNER
34
/wp-content/plugins/tom-banner/
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY
tom-banner.php
css/
style.css
AN EXAMPLE
HEADER (TOM-BANNER.PHP)
/**
* Plugin Name: Tom Banner
* Plugin URI: https://thomasvitale.com/tom-banner
* Description: Show a fixed banner to promote your brand new e-book.
* Version: 3.9.4
* Author: Thomas Vitale
* Author URI: https://thomasvitale.com
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: thomas
* Domain Path: /languages
*/
35
AN EXAMPLE
CALLBACK FUNCTION (TOM-BANNER.PHP)
function tom_banner_html() { ?>
<div class="book-banner">
<p>
Do you like reading?
<a href="#">Download</a> my new free e-book!
</p>
</div>
<?php }
add_action( 'wp_footer', ‘tom_banner_html' );
36
AN EXAMPLE
STYLESHEET LOADING (TOM-BANNER.PHP)
function tom_load_css() {
wp_enqueue_style(
'tom-banner',
plugins_url( 'css/style.css', __FILE__ )
);
}
add_action( 'wp_enqueue_scripts', 'tom_load_css' );
37
AN EXAMPLE
STYLESHEET (CSS/STYLE.CSS)
.book-banner {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
text-align: center;
padding: 10px 0;
background: #86151d;
min-height: 24px;
line-height: 24px;
color: #eeeeee;
font-size: 1em;
}
.book-banner p {
margin: 0;
padding: 5px;
}
.book-banner a {
color: #eee;
text-decoration: underline;
}
38
NEXT?
3. RESOURCES
39
RESOURCES
USEFUL RESOURCES
▸ WordPress Codex: https://codex.wordpress.org
▸ Plugin Developer Handbook: https://developer.wordpress.org/plugins/
▸ Professional WordPress: Design and Development, 3rd edition (Wrox), Brad
Williams, David Damstra, Hal Stern
▸ Smashing WordPress: Beyond the Blog, 4th edition, Thord Daniel Hedengren
▸ Codice sorgente plugin d’esempio e altre risorse: https://github.com/
ThomasVitale/GettingStartedWithWordPressPlugins
40
ARE YOU READY
TO DEVELOP YOUR
FIRST PLUGIN?
Thomas Vitale |@vitalethomas | #wctrn
41
This work is licensed under a Creative Commons Attribution 4.0 International License.

More Related Content

What's hot (20)

PDF
Professional WordPress Development with Vagrant - Andrea Cardinali - WordCam...
Andrea Cardinali
 
PDF
Making Magic with WP-CLI
ryanduff
 
PDF
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
ryanduff
 
PPT
Extending Your WordPress Toolbelt with WP-CLI
ryanduff
 
KEY
CSI: WordPress -- Getting Into the Guts
Dougal Campbell
 
PDF
Building a community of Open Source intranet users
Luke Oatham
 
PPTX
How to develope plugin in wordpress: 6 simple steps.
Jay Bharat
 
PPTX
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...
Sudeep Balchhaudi
 
PDF
PHPをさわらず作る!デザイナーさんのためのWordPress【超!初級】
Mami Kuroki
 
PPTX
WordPress Hardening
Maurizio Pelizzone
 
PDF
光速テーマ開発のコツ
Hishikawa Takuro
 
PDF
Mastering WordPress Vol.1
Wataru OKAMOTO
 
ODP
The Future Of WordPress Presentation
Dougal Campbell
 
PPTX
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
topher1kenobe
 
PPTX
Intro to Plugin Development, Miami WordCamp, 2015
topher1kenobe
 
PDF
Coding with jetpack
Rich Collier
 
ODP
Plone for python programmers
Dylan Jay
 
PDF
Approaches To WordPress Theme Development
Catch Themes
 
PPTX
Wordpress customer support
wordpress technical support
 
Professional WordPress Development with Vagrant - Andrea Cardinali - WordCam...
Andrea Cardinali
 
Making Magic with WP-CLI
ryanduff
 
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
ryanduff
 
Extending Your WordPress Toolbelt with WP-CLI
ryanduff
 
CSI: WordPress -- Getting Into the Guts
Dougal Campbell
 
Building a community of Open Source intranet users
Luke Oatham
 
How to develope plugin in wordpress: 6 simple steps.
Jay Bharat
 
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...
Sudeep Balchhaudi
 
PHPをさわらず作る!デザイナーさんのためのWordPress【超!初級】
Mami Kuroki
 
WordPress Hardening
Maurizio Pelizzone
 
光速テーマ開発のコツ
Hishikawa Takuro
 
Mastering WordPress Vol.1
Wataru OKAMOTO
 
The Future Of WordPress Presentation
Dougal Campbell
 
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
topher1kenobe
 
Intro to Plugin Development, Miami WordCamp, 2015
topher1kenobe
 
Coding with jetpack
Rich Collier
 
Plone for python programmers
Dylan Jay
 
Approaches To WordPress Theme Development
Catch Themes
 
Wordpress customer support
wordpress technical support
 

Similar to Getting Started With WordPress Plugin Development (20)

PPT
Where's the source, Luke? : How to find and debug the code behind Plone
Vincenzo Barone
 
PDF
Browser Extensions for Web Hackers
Mark Wubben
 
PDF
Blockchain Hyperledger Lab
Dev_Events
 
PDF
WordPress modern development
Roman Veselý
 
PDF
Chrome Extensions for Web Hackers
Mark Wubben
 
PDF
Upgrading Ember.js Apps
Ben Limmer
 
ODP
Technology / Open Source @ Creative Commons (CC Salon SF, August 2009)
Nathan Yergler
 
PDF
Jump into Squeak - Integrate Squeak projects with Docker & Github
hubx
 
ODP
Drupal Video Presentation
Eric Michalsen
 
PPT
Php2pdf
Eric Michalsen
 
PDF
Magento Fireside Chat: "Wiring Mageno Projects"
AOE
 
PDF
TYPO3 Flow 2.0 in the field - webtech Conference 2013
die.agilen GmbH
 
PPT
FVCP Ad Words
guest1575bb
 
PPT
Introduction to python scrapping
n|u - The Open Security Community
 
PDF
Use the PnP SharePoint Starter Kit to create your intranet in a box
Fabio Franzini
 
PDF
2018-10-17 J1 5D - Use the PnP SharePoint starter kit to create your Intranet...
Modern Workplace Conference Paris
 
PDF
Web components - a whirlwind tour
Martin Naumann
 
PDF
A Pocketful of Pro-tips
Tammy Valgardson
 
PPTX
Writing Your Own WordPress Plugins - WordCamp Kansas City, 2014
Pippin Williamson
 
PDF
[T3 ext day] all in one chat – real time chat
NITSAN Technologies
 
Where's the source, Luke? : How to find and debug the code behind Plone
Vincenzo Barone
 
Browser Extensions for Web Hackers
Mark Wubben
 
Blockchain Hyperledger Lab
Dev_Events
 
WordPress modern development
Roman Veselý
 
Chrome Extensions for Web Hackers
Mark Wubben
 
Upgrading Ember.js Apps
Ben Limmer
 
Technology / Open Source @ Creative Commons (CC Salon SF, August 2009)
Nathan Yergler
 
Jump into Squeak - Integrate Squeak projects with Docker & Github
hubx
 
Drupal Video Presentation
Eric Michalsen
 
Magento Fireside Chat: "Wiring Mageno Projects"
AOE
 
TYPO3 Flow 2.0 in the field - webtech Conference 2013
die.agilen GmbH
 
FVCP Ad Words
guest1575bb
 
Introduction to python scrapping
n|u - The Open Security Community
 
Use the PnP SharePoint Starter Kit to create your intranet in a box
Fabio Franzini
 
2018-10-17 J1 5D - Use the PnP SharePoint starter kit to create your Intranet...
Modern Workplace Conference Paris
 
Web components - a whirlwind tour
Martin Naumann
 
A Pocketful of Pro-tips
Tammy Valgardson
 
Writing Your Own WordPress Plugins - WordCamp Kansas City, 2014
Pippin Williamson
 
[T3 ext day] all in one chat – real time chat
NITSAN Technologies
 
Ad

Recently uploaded (20)

PPTX
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
PDF
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
PDF
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
PDF
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
PDF
Learning Exemplar_Technology and Livelihood Education 7 Q1_W2.pdf
mjhiludo16
 
PDF
google promotion services in Delhi, India
Digital Web Future
 
PDF
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
PPTX
Introduction-to-the-AWS-Solution-Architect.pptx
Prince391830
 
PPTX
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
PDF
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
PDF
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
PPTX
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
PDF
Strategic Plan New and Completed Templeted
alvi932317
 
PPTX
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
PPTX
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
PPTX
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
PDF
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
PPTX
Meloniusk_Communication_Template_best.pptx
howesix147
 
PDF
AI security AI security AI security AI security
elite44
 
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
Beginning-Laravel-Build-Websites-with-Laravel-5.8-by-Sanjib-Sinha-z-lib.org.pdf
TagumLibuganonRiverB
 
Learning Exemplar_Technology and Livelihood Education 7 Q1_W2.pdf
mjhiludo16
 
google promotion services in Delhi, India
Digital Web Future
 
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
Introduction-to-the-AWS-Solution-Architect.pptx
Prince391830
 
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
Strategic Plan New and Completed Templeted
alvi932317
 
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
Meloniusk_Communication_Template_best.pptx
howesix147
 
AI security AI security AI security AI security
elite44
 
Ad

Getting Started With WordPress Plugin Development