SlideShare a Scribd company logo
1 of 12
Building your first
           WordPress plugin
●
    Justin Foell
●
    Developer at 9seeds
●
    justin@9seeds.com
●
    @justinfoell
I found some sweet code,
           where does it go?
●
    Let's look at an example: admin bar
●
    Pitfalls of adding it to functions.php
When should code go in a
       theme's functions.php?
●
    One question:
    Would you still want the feature if the
    theme was changed?
●
    If YES, put it in a plugin
●   If NO, you can put it in functions.php, but
    consider renaming the theme or creating a
    child theme to avoid upgrade issues
Holy crap! Plugins sound hard!
●
    Writing a Plugin Documentation
●
    Let's start with the bare minimum
●
    Who knows how to type?
●
    You can build a plugin!
myplugin.php
<?php
/*
Plugin Name: My Plugin
*/
Going beyond WordPress basics
●
    I can't upload a certain file type
●
    There's a fix for that: upload types
Plugins can be as big or small as
            you want
●
    If you have a feature that you might want to
    turn on/off independently of others:
    Put it in it's own plugin
    Example: Disable upgrade notice
Getting Advanced: shortcode
●
    “Snippets” are a gateway into WordPress
    customization
●
    Advanced example:
    PayPal donation shortcode
Other Examples
●
    Shortcodes in widgets
    I'm not sure why the “Text” widget doesn't
    do this already – how to fix
●
    Audience Examples?
Be careful out there!
●
    But don't be afraid to experiment
●
    Create another WordPress instance to test
●
    I havent (yet) seen a “malicious”
    WordPress code snippet
●
    Some examples may be out of date, overly
    complex, or blatantly wrong
Knowing your limits
●
    Copying & Pasting will probably only get
    you so far
●
    If an example is very long, there's a chance
    it might already be a plugin – look there in
    stead
●
    Consult you friendly local developer – a
    local WordPress meetup (and/or mailing
    list) is probably your best bet
Thank You!
●
    Justin Foell - Developer
●
    9seeds.com – professional WordPress
    development
●
    justin@9seeds.com
●
    Code examples: bit.ly/jf-wclv2012
●
    Slides: bit.ly/jf-wclv2012-slides

More Related Content

What's hot

Web designp pt
Web designp ptWeb designp pt
Web designp pt
Bizzyb09
 
Baawjsajq109
Baawjsajq109Baawjsajq109
Baawjsajq109
Thinkful
 
Question 6
Question 6Question 6
Question 6
guidzzz
 

What's hot (20)

Develop, Debug, Learn? - Dotjs2019
Develop, Debug, Learn? - Dotjs2019Develop, Debug, Learn? - Dotjs2019
Develop, Debug, Learn? - Dotjs2019
 
Web designp pt
Web designp ptWeb designp pt
Web designp pt
 
Starting off in PhotoShiop and how it fits into the web design process
Starting off in PhotoShiop and how it fits into the web design processStarting off in PhotoShiop and how it fits into the web design process
Starting off in PhotoShiop and how it fits into the web design process
 
Getting Started with Browser Based Testing
Getting Started with Browser Based TestingGetting Started with Browser Based Testing
Getting Started with Browser Based Testing
 
Zero cost serverless Real time web app
Zero cost serverless Real time web appZero cost serverless Real time web app
Zero cost serverless Real time web app
 
Beg, Borrow or Steal: The Art of Flashing Without Flashing
Beg, Borrow or Steal: The Art of Flashing Without FlashingBeg, Borrow or Steal: The Art of Flashing Without Flashing
Beg, Borrow or Steal: The Art of Flashing Without Flashing
 
Debugging WordPress Core and Plugins!
Debugging WordPress Core and Plugins!Debugging WordPress Core and Plugins!
Debugging WordPress Core and Plugins!
 
Baawjsajq109
Baawjsajq109Baawjsajq109
Baawjsajq109
 
Static site best practices
Static site best practicesStatic site best practices
Static site best practices
 
Question 6
Question 6Question 6
Question 6
 
WordPress Plugins (WordCamp Utah)
WordPress Plugins (WordCamp Utah)WordPress Plugins (WordCamp Utah)
WordPress Plugins (WordCamp Utah)
 
WordPress translation & Localisation : Avoid common mistakes by Makarand Mane
WordPress translation & Localisation : Avoid common mistakes by Makarand ManeWordPress translation & Localisation : Avoid common mistakes by Makarand Mane
WordPress translation & Localisation : Avoid common mistakes by Makarand Mane
 
Create a newsletter in less than 17 minutes without writing a single word
Create a newsletter in less than 17 minutes without writing a single wordCreate a newsletter in less than 17 minutes without writing a single word
Create a newsletter in less than 17 minutes without writing a single word
 
Why do you say BDD if it is Cucumber?
Why do you say BDD if it is Cucumber?Why do you say BDD if it is Cucumber?
Why do you say BDD if it is Cucumber?
 
Wordpress hacks
Wordpress hacksWordpress hacks
Wordpress hacks
 
Tf byows
Tf byowsTf byows
Tf byows
 
Architecture @ Appknox
Architecture @ AppknoxArchitecture @ Appknox
Architecture @ Appknox
 
The road to php 7.1
The road to php 7.1The road to php 7.1
The road to php 7.1
 
Question 6
Question 6Question 6
Question 6
 
Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-13-66-123-168
Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-13-66-123-168Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-13-66-123-168
Deck 8983a1d9-68df-4447-8481-3b4fd0de734c-13-66-123-168
 

Viewers also liked

Module 8 Interaction
Module 8 InteractionModule 8 Interaction
Module 8 Interaction
schernick
 
Module 7 Preparation
Module 7 PreparationModule 7 Preparation
Module 7 Preparation
schernick
 
Module 8 Preparation
Module 8 PreparationModule 8 Preparation
Module 8 Preparation
schernick
 
Module 6 Interaction
Module 6 InteractionModule 6 Interaction
Module 6 Interaction
schernick
 
Module 7 Interaction
Module 7 InteractionModule 7 Interaction
Module 7 Interaction
schernick
 
AJAX the WordPress way
AJAX the WordPress wayAJAX the WordPress way
AJAX the WordPress way
Justin Foell
 
เล่มจริง
เล่มจริงเล่มจริง
เล่มจริง
Krukook Sut
 
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمينعرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
MOKBAL
 
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمينعرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
MOKBAL
 
27 simple sentences
27 simple sentences27 simple sentences
27 simple sentences
vaibhav1996
 

Viewers also liked (19)

Pimp your Gmail to get more done
Pimp your Gmail to get more donePimp your Gmail to get more done
Pimp your Gmail to get more done
 
Module 8 Interaction
Module 8 InteractionModule 8 Interaction
Module 8 Interaction
 
Module 7 Preparation
Module 7 PreparationModule 7 Preparation
Module 7 Preparation
 
Module 8 Preparation
Module 8 PreparationModule 8 Preparation
Module 8 Preparation
 
Biofuels
BiofuelsBiofuels
Biofuels
 
Module 6 Interaction
Module 6 InteractionModule 6 Interaction
Module 6 Interaction
 
Module 7 Interaction
Module 7 InteractionModule 7 Interaction
Module 7 Interaction
 
AJAX the WordPress way
AJAX the WordPress wayAJAX the WordPress way
AJAX the WordPress way
 
Naica crystalcavemexico
Naica crystalcavemexicoNaica crystalcavemexico
Naica crystalcavemexico
 
เล่มจริง
เล่มจริงเล่มจริง
เล่มจริง
 
Where do I go from here?
Where do I go from here?Where do I go from here?
Where do I go from here?
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)
 
S peters final_dse
S peters final_dseS peters final_dse
S peters final_dse
 
New york city
New york cityNew york city
New york city
 
Customizing the WP Admin for fun and profit
Customizing the WP Admin for fun and profitCustomizing the WP Admin for fun and profit
Customizing the WP Admin for fun and profit
 
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمينعرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
 
Minimum Viable Product
Minimum Viable ProductMinimum Viable Product
Minimum Viable Product
 
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمينعرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
عرض بور بوينت عن اخلاقيات استخدام الانترنت وحماية المستخدمين
 
27 simple sentences
27 simple sentences27 simple sentences
27 simple sentences
 

Similar to Building your first WordPress plugin

WordPress 101 Sunday Session
WordPress 101 Sunday SessionWordPress 101 Sunday Session
WordPress 101 Sunday Session
pamselle
 
WordPress 101 Saturday Session
WordPress 101 Saturday SessionWordPress 101 Saturday Session
WordPress 101 Saturday Session
pamselle
 
How to create a WordPress not understanding WordPress, so more on the headles...
How to create a WordPress not understanding WordPress, so more on the headles...How to create a WordPress not understanding WordPress, so more on the headles...
How to create a WordPress not understanding WordPress, so more on the headles...
Krzysztof (Chris) Ozog
 
WPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin DevelopmentWPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin Development
Caldera Labs
 

Similar to Building your first WordPress plugin (20)

WordPress 101 Sunday Session
WordPress 101 Sunday SessionWordPress 101 Sunday Session
WordPress 101 Sunday Session
 
WordPress Commercial Plugins
WordPress Commercial PluginsWordPress Commercial Plugins
WordPress Commercial Plugins
 
Test ss 2
Test ss 2Test ss 2
Test ss 2
 
Plugin Development for Beginners v.2019
Plugin Development for Beginners v.2019Plugin Development for Beginners v.2019
Plugin Development for Beginners v.2019
 
Getting big without getting fat, in perl
Getting big without getting fat, in perlGetting big without getting fat, in perl
Getting big without getting fat, in perl
 
Plugin Development for Beginners
Plugin Development for BeginnersPlugin Development for Beginners
Plugin Development for Beginners
 
WordPress 101 Saturday Session
WordPress 101 Saturday SessionWordPress 101 Saturday Session
WordPress 101 Saturday Session
 
How to create a WordPress not understanding WordPress, so more on the headles...
How to create a WordPress not understanding WordPress, so more on the headles...How to create a WordPress not understanding WordPress, so more on the headles...
How to create a WordPress not understanding WordPress, so more on the headles...
 
WPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin DevelopmentWPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin Development
 
Developing Custom WordPress Themes for Clients
Developing Custom WordPress Themes for ClientsDeveloping Custom WordPress Themes for Clients
Developing Custom WordPress Themes for Clients
 
WordPress plugins
WordPress pluginsWordPress plugins
WordPress plugins
 
WordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute WorkshopWordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute Workshop
 
Xdebug for Beginners
Xdebug for BeginnersXdebug for Beginners
Xdebug for Beginners
 
How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.How to develope plugin in wordpress: 6 simple steps.
How to develope plugin in wordpress: 6 simple steps.
 
Writing Your First Plugin
Writing Your First PluginWriting Your First Plugin
Writing Your First Plugin
 
Rapid WordPress Theme Development
Rapid WordPress Theme DevelopmentRapid WordPress Theme Development
Rapid WordPress Theme Development
 
Learning Joomla! in a weekend (for developers)
Learning Joomla! in a weekend (for developers)Learning Joomla! in a weekend (for developers)
Learning Joomla! in a weekend (for developers)
 
Making the Most of Plug-ins - WordCamp Toronto 2008
Making the Most of Plug-ins - WordCamp Toronto 2008Making the Most of Plug-ins - WordCamp Toronto 2008
Making the Most of Plug-ins - WordCamp Toronto 2008
 
It4k12 wordpress
It4k12 wordpressIt4k12 wordpress
It4k12 wordpress
 
Modular plugins
Modular pluginsModular plugins
Modular plugins
 

Recently uploaded

Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Building your first WordPress plugin

  • 1. Building your first WordPress plugin ● Justin Foell ● Developer at 9seeds ● justin@9seeds.com ● @justinfoell
  • 2. I found some sweet code, where does it go? ● Let's look at an example: admin bar ● Pitfalls of adding it to functions.php
  • 3. When should code go in a theme's functions.php? ● One question: Would you still want the feature if the theme was changed? ● If YES, put it in a plugin ● If NO, you can put it in functions.php, but consider renaming the theme or creating a child theme to avoid upgrade issues
  • 4. Holy crap! Plugins sound hard! ● Writing a Plugin Documentation ● Let's start with the bare minimum ● Who knows how to type? ● You can build a plugin!
  • 6. Going beyond WordPress basics ● I can't upload a certain file type ● There's a fix for that: upload types
  • 7. Plugins can be as big or small as you want ● If you have a feature that you might want to turn on/off independently of others: Put it in it's own plugin Example: Disable upgrade notice
  • 8. Getting Advanced: shortcode ● “Snippets” are a gateway into WordPress customization ● Advanced example: PayPal donation shortcode
  • 9. Other Examples ● Shortcodes in widgets I'm not sure why the “Text” widget doesn't do this already – how to fix ● Audience Examples?
  • 10. Be careful out there! ● But don't be afraid to experiment ● Create another WordPress instance to test ● I havent (yet) seen a “malicious” WordPress code snippet ● Some examples may be out of date, overly complex, or blatantly wrong
  • 11. Knowing your limits ● Copying & Pasting will probably only get you so far ● If an example is very long, there's a chance it might already be a plugin – look there in stead ● Consult you friendly local developer – a local WordPress meetup (and/or mailing list) is probably your best bet
  • 12. Thank You! ● Justin Foell - Developer ● 9seeds.com – professional WordPress development ● justin@9seeds.com ● Code examples: bit.ly/jf-wclv2012 ● Slides: bit.ly/jf-wclv2012-slides