SlideShare ist ein Scribd-Unternehmen logo
1 von 114
Intro to WordPress    Doug Stewart
                      Philly Tech Week 2012
            Plugins
Intro to WordPress Plugins
Philly Tech Week 2012
Philadelphia Inquirer Building
April 25th, 2012
Who am I?
Who am I?

• Doug Stewart
Who am I?

• Doug Stewart


• Philly WordPress Meetup co-organizer
Who am I?

• Doug Stewart


• Philly WordPress Meetup co-organizer


• Using WordPress since version 1.0 (February 2004 or so)
Who am I?

• Doug Stewart


• Philly WordPress Meetup co-organizer


• Using WordPress since version 1.0 (February 2004 or so)


• @zamoose on Twitter
Why are we here?
Why are we here?


•Plugins!
What’s a plugin?
What’s a plugin?

• The WordPress Codex* defines
  a plugin as:
 “[...]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).”**
What’s a plugin?

• The WordPress Codex* defines
  a plugin as:
  “[...]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).”**




* You do know what the Codex is, right?
** http://codex.wordpress.org/Writing_a_Plugin
WHAT?
A plugin...
A plugin...

• Is a piece of software
A plugin...

• Is a piece of software


• Is usually written in a mix of PHP and JavaScript
A plugin...

• Is a piece of software


• Is usually written in a mix of PHP and JavaScript


• Supplements or substantially alters the way WordPress functions
A plugin...

• Is a piece of software


• Is usually written in a mix of PHP and JavaScript


• Supplements or substantially alters the way WordPress functions


• Uses the WordPress Plugin API* to accomplish the above in a way that
  integrates with WordPress
A plugin...

• Is a piece of software


• Is usually written in a mix of PHP and JavaScript


• Supplements or substantially alters the way WordPress functions


• Uses the WordPress Plugin API* to accomplish the above in a way that
  integrates with WordPress




                      * http://codex.wordpress.org/Plugin_API
A few notable plugins
A few notable plugins

• Hello Dolly
A few notable plugins

• Hello Dolly


• Akismet
A few notable plugins

• Hello Dolly


• Akismet


• BuddyPress
A few notable plugins

• Hello Dolly


• Akismet


• BuddyPress


• WordPress SEO
A few notable plugins

• Hello Dolly


• Akismet


• BuddyPress


• WordPress SEO


• bbPress
Creating your own
Step 1: What do you want to do?
Step 1.1: Has anyone ELSE tried to do this?
Step 1.2: Has anyone else done this poorly?
http://wordpress.org/extend/plugins/
http://wordpress.org/extend/plugins/
http://wordpress.org/extend/plugins/
http://wordpress.org/extend/plugins/
At this point, this effect
will likely kick in.
At this point, this effect
will likely kick in.

• Fight the instinct to
  procrastinate.
At this point, this effect
will likely kick in.

• Fight the instinct to
  procrastinate.


• Plan.
At this point, this effect
will likely kick in.

• Fight the instinct to
  procrastinate.


• Plan.


• Wireframe.
At this point, this effect
will likely kick in.

• Fight the instinct to
  procrastinate.


• Plan.


• Wireframe.


• Pen and paper can help.
Step 2: Getting Started
Getting started
Getting started

• This sounds simple, but pick a name for your plugin
Getting started

• This sounds simple, but pick a name for your plugin


• Now pick a “slug” for your plugin
Getting started

• This sounds simple, but pick a name for your plugin


• Now pick a “slug” for your plugin


• Check your slug against existing plugins
Getting started

• This sounds simple, but pick a name for your plugin


• Now pick a “slug” for your plugin


• Check your slug against existing plugins


   • Slugs are universally used by WordPress to identify plugins
Getting started

• This sounds simple, but pick a name for your plugin


• Now pick a “slug” for your plugin


• Check your slug against existing plugins


   • Slugs are universally used by WordPress to identify plugins


   • If you somehow end up with a slug that matches another plugin’s,
     there will be trouble
Getting started

• This sounds simple, but pick a name for your plugin


• Now pick a “slug” for your plugin


• Check your slug against existing plugins


   • Slugs are universally used by WordPress to identify plugins


   • If you somehow end up with a slug that matches another plugin’s,
     there will be trouble


   • Easy solution: unique slug prefix
Getting started (cont.)




            Plugin Name: LB ColorBox

             Plugin Slug: lb-colorbox
Getting started (cont.)
Getting started (cont.)

• Read about the plugin submission process at http://wordpress.org/extend/plugins/about/
Getting started (cont.)

• Read about the plugin submission process at http://wordpress.org/extend/plugins/about/


• Go to http://wordpress.org/extend/plugins/add/
Getting started (cont.)

• Read about the plugin submission process at http://wordpress.org/extend/plugins/about/


• Go to http://wordpress.org/extend/plugins/add/


• Log in with your WordPress.org account
Getting started (cont.)

• Read about the plugin submission process at http://wordpress.org/extend/plugins/about/


• Go to http://wordpress.org/extend/plugins/add/


• Log in with your WordPress.org account


• Register your new plugin
Getting started (cont.)

• Read about the plugin submission process at http://wordpress.org/extend/plugins/about/


• Go to http://wordpress.org/extend/plugins/add/


• Log in with your WordPress.org account


• Register your new plugin


   • Name and description are required
Getting started (cont.)

• Read about the plugin submission process at http://wordpress.org/extend/plugins/about/


• Go to http://wordpress.org/extend/plugins/add/


• Log in with your WordPress.org account


• Register your new plugin


   • Name and description are required


• Wait for The Powers That Be to approve your plugin submission
Getting started (cont.)

• Read about the plugin submission process at http://wordpress.org/extend/plugins/about/


• Go to http://wordpress.org/extend/plugins/add/


• Log in with your WordPress.org account


• Register your new plugin


   • Name and description are required


• Wait for The Powers That Be to approve your plugin submission


• While you wait...
Step 3: Set up your development environment
Set up your development environment
Set up your development environment

• You’ll need a development environment
Set up your development environment

• You’ll need a development environment


  • Local?
Set up your development environment

• You’ll need a development environment


  • Local?


  • Remote?
Set up your development environment

• You’ll need a development environment


  • Local?


  • Remote?


• Local development environment is preferable
Set up your development environment

• You’ll need a development environment


  • Local?


  • Remote?


• Local development environment is preferable


  • Disconnected development
Set up your development environment

• You’ll need a development environment


  • Local?


  • Remote?


• Local development environment is preferable


  • Disconnected development


  • No waiting for uploads
Set up your development environment

• You’ll need a development environment


  • Local?


  • Remote?


• Local development environment is preferable


  • Disconnected development


  • No waiting for uploads


  • Master of your own domain
Set up your development environment (cont.)
Set up your development environment (cont.)

• Windows
Set up your development environment (cont.)

• Windows


  • WAMP (http://www.wampserver.com/en/)
Set up your development environment (cont.)

• Windows


  • WAMP (http://www.wampserver.com/en/)


  • XAMPP (http://www.apachefriends.org/en/xampp-windows.html)
Set up your development environment (cont.)

• Windows


  • WAMP (http://www.wampserver.com/en/)


  • XAMPP (http://www.apachefriends.org/en/xampp-windows.html)


• OS X
Set up your development environment (cont.)

• Windows


  • WAMP (http://www.wampserver.com/en/)


  • XAMPP (http://www.apachefriends.org/en/xampp-windows.html)


• OS X


  • MAMP (http://www.mamp.info/en/index.html)
Set up your development environment (cont.)

• Windows


  • WAMP (http://www.wampserver.com/en/)


  • XAMPP (http://www.apachefriends.org/en/xampp-windows.html)


• OS X


  • MAMP (http://www.mamp.info/en/index.html)


  • XAMPP (http://www.apachefriends.org/en/xampp-macosx.html)
Set up your development environment (cont.)

• Windows


  • WAMP (http://www.wampserver.com/en/)


  • XAMPP (http://www.apachefriends.org/en/xampp-windows.html)


• OS X


  • MAMP (http://www.mamp.info/en/index.html)


  • XAMPP (http://www.apachefriends.org/en/xampp-macosx.html)


  • NMPP (http://getmnpp.org/)
Set up your development
environment (cont.)
Set up your development
environment (cont.)

• Install WordPress
Set up your development
environment (cont.)

• Install WordPress


• Create a new directory under
  [WordPress install directory]/
  wp-content/plugins
Set up your development
environment (cont.)

• Install WordPress


• Create a new directory under
  [WordPress install directory]/
  wp-content/plugins


   • Make sure it matches your
     slug!
Step 4: Skeleton
Skeleton
Skeleton

• Let’s put “pen” to “paper”
Skeleton

• Let’s put “pen” to “paper”


• A plugin must have at least the following two files:
Skeleton

• Let’s put “pen” to “paper”


• A plugin must have at least the following two files:


   • readme.txt
Skeleton

• Let’s put “pen” to “paper”


• A plugin must have at least the following two files:


   • readme.txt


   • [plugin-slug].php
Step 4.1: readme.txt
readme.txt
readme.txt

• Full example here: http://wordpress.org/extend/plugins/about/readme.txt
readme.txt

• Full example here: http://wordpress.org/extend/plugins/about/readme.txt


• The important bits are at the top
readme.txt

• Full example here: http://wordpress.org/extend/plugins/about/readme.txt


• The important bits are at the top


• Uses a modified Markdown syntax
readme.txt

• Full example here: http://wordpress.org/extend/plugins/about/readme.txt


• The important bits are at the top


• Uses a modified Markdown syntax


• Contains important information about your theme
readme.txt

• Full example here: http://wordpress.org/extend/plugins/about/readme.txt


• The important bits are at the top


• Uses a modified Markdown syntax


• Contains important information about your theme


• Explicitly controls how your plugin’s WordPress.org directory page looks
readme.txt (cont.)


                     This...


                      Text
readme.txt (cont.)


                     ...results in this
readme.txt (cont.)

• WordPress.org has a handy-dandy readme syntax checker:

 http://wordpress.org/extend/plugins/about/validator/


• Other information displayed


  • Installation instructions


  • FAQs


  • Screenshots


  • Changelog
Step 4.2: [plugin-slug].php
[plugin-slug].php

• Create wp-content/plugins/[plugin-slug]/[plugin-slug].php


• Add plugin header information so WordPress knows how to talk about your
  plugin


• Plugin header info defines how WordPress displays your plugin’s info in the
  Plugins administration screen
[plugin-slug].php (cont.)

                        This...
[plugin-slug].php


                    ...defines this
Step 5: Put some meat on those bones
Meat
Meat

• Let’s talk APIs
Meat

• Let’s talk APIs


   • WordPress core -- http://codex.wordpress.org/Function_Reference
Meat

• Let’s talk APIs


   • WordPress core -- http://codex.wordpress.org/Function_Reference


      • the_title(), get_posts(), add_meta_box(), etc.
Meat

• Let’s talk APIs


   • WordPress core -- http://codex.wordpress.org/Function_Reference


      • the_title(), get_posts(), add_meta_box(), etc.


   • Plugin API -- http://codex.wordpress.org/Plugin_API
Meat (cont.)

• Topics for advanced study


  • Settings API -- http://codex.wordpress.org/Settings_API


  • Options API -- http://codex.wordpress.org/Options_API


  • Transients API -- http://codex.wordpress.org/Transients_API


  • Widgets API -- http://codex.wordpress.org/Widgets_API
Meathooks

• From the Codex:
  “Hooks are provided by WordPress to allow your plugin to 'hook into' the rest
  of WordPress; that is, to call functions in your plugin at specific times, and
  thereby set your plugin in motion.”
Meathooks (cont.)
Meathooks (cont.)

• There are two kinds of hooks (again, from the Codex):
Meathooks (cont.)

• There are two kinds of hooks (again, from the Codex):


  • “Actions: Actions are the hooks that the WordPress core launches at
    specific points during execution, or when specific events occur. Your plugin
    can specify that one or more of its PHP functions are executed at these
    points, using the Action API.”
Meathooks (cont.)

• There are two kinds of hooks (again, from the Codex):


  • “Actions: Actions are the hooks that the WordPress core launches at
    specific points during execution, or when specific events occur. Your plugin
    can specify that one or more of its PHP functions are executed at these
    points, using the Action API.”


  • “Filters: Filters are the hooks that WordPress launches to modify text of
    various types before adding it to the database or sending it to the browser
    screen. Your plugin can specify that one or more of its PHP functions is
    executed to modify specific types of text at these times, using the Filter
    API.”
Demo Time!
Resources

• Codex, Codex, Codex
  http://codex.wordpress.org


• StackExchange
  http://wordpress.stackexchange.com


• WordPress.org forums
Useful kickstarts

• WordPress Plugin Kickstarter
  http://wordpress.org/extend/plugins/wordpress-plugin-kickstarter/


• WordPress Plugin Scaffold
  https://github.com/eteubert/WordPress-Plugin-Scaffold


• WordPress Plugin Boilerplate
  https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate


• WordPress Plugin Skeleton
  https://github.com/lpointet/WordPress-Plugin-Skeleton
Thanks for coming out!

Weitere ähnliche Inhalte

Was ist angesagt?

Theme development essentials columbus oh word camp 2012
Theme development essentials   columbus oh word camp 2012Theme development essentials   columbus oh word camp 2012
Theme development essentials columbus oh word camp 2012
Joe Querin
 
Theme frameworks & child themes
Theme frameworks & child themesTheme frameworks & child themes
Theme frameworks & child themes
Chris Olbekson
 

Was ist angesagt? (20)

Word Press
Word PressWord Press
Word Press
 
Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)
 
Theme development essentials columbus oh word camp 2012
Theme development essentials   columbus oh word camp 2012Theme development essentials   columbus oh word camp 2012
Theme development essentials columbus oh word camp 2012
 
WordCamp Seoul 2012
WordCamp Seoul 2012WordCamp Seoul 2012
WordCamp Seoul 2012
 
Adding Content to your WordPress Website
Adding Content to your WordPress WebsiteAdding Content to your WordPress Website
Adding Content to your WordPress Website
 
How to customise Joomla
How to customise JoomlaHow to customise Joomla
How to customise Joomla
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPress
 
Accessibility With WordPress: Accessing Higher Ground 2014
Accessibility With WordPress: Accessing Higher Ground 2014Accessibility With WordPress: Accessing Higher Ground 2014
Accessibility With WordPress: Accessing Higher Ground 2014
 
WordPress Essentials for Beginners - YES Montreal November 2015
WordPress Essentials for Beginners - YES Montreal November 2015WordPress Essentials for Beginners - YES Montreal November 2015
WordPress Essentials for Beginners - YES Montreal November 2015
 
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
 
The Basics of WordPress
The Basics of WordPressThe Basics of WordPress
The Basics of WordPress
 
Theme frameworks & child themes
Theme frameworks & child themesTheme frameworks & child themes
Theme frameworks & child themes
 
WordPress plugins
WordPress pluginsWordPress plugins
WordPress plugins
 
Learning by Doing: 10 Lessons in Pushing your WordPress Development Skills
Learning by Doing: 10 Lessons in Pushing your WordPress Development SkillsLearning by Doing: 10 Lessons in Pushing your WordPress Development Skills
Learning by Doing: 10 Lessons in Pushing your WordPress Development Skills
 
Wordpress theme submission requirement for Themeforest
Wordpress theme submission requirement for ThemeforestWordpress theme submission requirement for Themeforest
Wordpress theme submission requirement for Themeforest
 
Introduction To WordPress
Introduction To WordPressIntroduction To WordPress
Introduction To WordPress
 
Setting Up your WordPress Site like a Pro
Setting Up your WordPress Site like a ProSetting Up your WordPress Site like a Pro
Setting Up your WordPress Site like a Pro
 
WordPress Meetup Bandung - December 2014
WordPress Meetup Bandung - December 2014WordPress Meetup Bandung - December 2014
WordPress Meetup Bandung - December 2014
 
What Is WordPress and Why Is Everyone Talking About It
What Is WordPress and Why Is Everyone Talking About ItWhat Is WordPress and Why Is Everyone Talking About It
What Is WordPress and Why Is Everyone Talking About It
 
Introduce Bootstrap 3 to Develop Responsive Design Application
Introduce Bootstrap 3 to Develop Responsive Design ApplicationIntroduce Bootstrap 3 to Develop Responsive Design Application
Introduce Bootstrap 3 to Develop Responsive Design Application
 

Andere mochten auch (7)

WordPress Plugins (WordCamp Utah)
WordPress Plugins (WordCamp Utah)WordPress Plugins (WordCamp Utah)
WordPress Plugins (WordCamp Utah)
 
WordPress Plugins For Website Development
WordPress Plugins For Website DevelopmentWordPress Plugins For Website Development
WordPress Plugins For Website Development
 
WordPress Plugins
WordPress PluginsWordPress Plugins
WordPress Plugins
 
Intro to WordPress Plugins
Intro to WordPress PluginsIntro to WordPress Plugins
Intro to WordPress Plugins
 
Creating and Maintaining WordPress Plugins
Creating and Maintaining WordPress PluginsCreating and Maintaining WordPress Plugins
Creating and Maintaining WordPress Plugins
 
Coding, Scaling, and Deploys... Oh My!
Coding, Scaling, and Deploys... Oh My!Coding, Scaling, and Deploys... Oh My!
Coding, Scaling, and Deploys... Oh My!
 
Adding a Social 'Stache to WordPress: BuddyPress, bbPress and Beyond
Adding a Social 'Stache to WordPress: BuddyPress, bbPress and BeyondAdding a Social 'Stache to WordPress: BuddyPress, bbPress and Beyond
Adding a Social 'Stache to WordPress: BuddyPress, bbPress and Beyond
 

Ähnlich wie Intro to WordPress Plugins

Ähnlich wie Intro to WordPress Plugins (20)

Presentation wordpress.pptx
Presentation wordpress.pptxPresentation wordpress.pptx
Presentation wordpress.pptx
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
 
ALL ABOUT WORDPRESS WEBSITE
ALL ABOUT WORDPRESS WEBSITE ALL ABOUT WORDPRESS WEBSITE
ALL ABOUT WORDPRESS WEBSITE
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
 
Presentation wordpress.pptx
Presentation wordpress.pptxPresentation wordpress.pptx
Presentation wordpress.pptx
 
Protect Your WordPress From The Inside Out
Protect Your WordPress From The Inside OutProtect Your WordPress From The Inside Out
Protect Your WordPress From The Inside Out
 
There's No Crying In Wordpress! (an intro to WP)
There's No Crying In Wordpress! (an intro to WP)There's No Crying In Wordpress! (an intro to WP)
There's No Crying In Wordpress! (an intro to WP)
 
Presentation wordpress.pptx
Presentation wordpress.pptxPresentation wordpress.pptx
Presentation wordpress.pptx
 
Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016
 
Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016
 
Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016
 
WordPress Security and Best Practices
WordPress Security and Best PracticesWordPress Security and Best Practices
WordPress Security and Best Practices
 
Exploring the WordPress Dashboard and How to Pick & Install Plugins
Exploring the WordPress Dashboard and How to Pick & Install PluginsExploring the WordPress Dashboard and How to Pick & Install Plugins
Exploring the WordPress Dashboard and How to Pick & Install Plugins
 
Passionate About Plugins and Wild for Widgets
Passionate About Plugins and Wild for WidgetsPassionate About Plugins and Wild for Widgets
Passionate About Plugins and Wild for Widgets
 
From WordPress With Love
From WordPress With LoveFrom WordPress With Love
From WordPress With Love
 
WordPress Plugins and Security
WordPress Plugins and SecurityWordPress Plugins and Security
WordPress Plugins and Security
 
15 Essential WordPress Plugins
15 Essential WordPress Plugins15 Essential WordPress Plugins
15 Essential WordPress Plugins
 
Development tools
Development toolsDevelopment tools
Development tools
 
CALM Wordpress 102
CALM Wordpress 102CALM Wordpress 102
CALM Wordpress 102
 
Becoming A WordPress Beta Tester
Becoming A WordPress Beta TesterBecoming A WordPress Beta Tester
Becoming A WordPress Beta Tester
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Intro to WordPress Plugins

  • 1. Intro to WordPress Doug Stewart Philly Tech Week 2012 Plugins
  • 2. Intro to WordPress Plugins Philly Tech Week 2012 Philadelphia Inquirer Building April 25th, 2012
  • 4. Who am I? • Doug Stewart
  • 5. Who am I? • Doug Stewart • Philly WordPress Meetup co-organizer
  • 6. Who am I? • Doug Stewart • Philly WordPress Meetup co-organizer • Using WordPress since version 1.0 (February 2004 or so)
  • 7. Who am I? • Doug Stewart • Philly WordPress Meetup co-organizer • Using WordPress since version 1.0 (February 2004 or so) • @zamoose on Twitter
  • 8. Why are we here?
  • 9. Why are we here? •Plugins!
  • 11. What’s a plugin? • The WordPress Codex* defines a plugin as: “[...]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).”**
  • 12. What’s a plugin? • The WordPress Codex* defines a plugin as: “[...]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).”** * You do know what the Codex is, right? ** http://codex.wordpress.org/Writing_a_Plugin
  • 13. WHAT?
  • 15. A plugin... • Is a piece of software
  • 16. A plugin... • Is a piece of software • Is usually written in a mix of PHP and JavaScript
  • 17. A plugin... • Is a piece of software • Is usually written in a mix of PHP and JavaScript • Supplements or substantially alters the way WordPress functions
  • 18. A plugin... • Is a piece of software • Is usually written in a mix of PHP and JavaScript • Supplements or substantially alters the way WordPress functions • Uses the WordPress Plugin API* to accomplish the above in a way that integrates with WordPress
  • 19. A plugin... • Is a piece of software • Is usually written in a mix of PHP and JavaScript • Supplements or substantially alters the way WordPress functions • Uses the WordPress Plugin API* to accomplish the above in a way that integrates with WordPress * http://codex.wordpress.org/Plugin_API
  • 20. A few notable plugins
  • 21. A few notable plugins • Hello Dolly
  • 22. A few notable plugins • Hello Dolly • Akismet
  • 23. A few notable plugins • Hello Dolly • Akismet • BuddyPress
  • 24. A few notable plugins • Hello Dolly • Akismet • BuddyPress • WordPress SEO
  • 25. A few notable plugins • Hello Dolly • Akismet • BuddyPress • WordPress SEO • bbPress
  • 27. Step 1: What do you want to do?
  • 28. Step 1.1: Has anyone ELSE tried to do this?
  • 29. Step 1.2: Has anyone else done this poorly?
  • 34. At this point, this effect will likely kick in.
  • 35. At this point, this effect will likely kick in. • Fight the instinct to procrastinate.
  • 36. At this point, this effect will likely kick in. • Fight the instinct to procrastinate. • Plan.
  • 37. At this point, this effect will likely kick in. • Fight the instinct to procrastinate. • Plan. • Wireframe.
  • 38. At this point, this effect will likely kick in. • Fight the instinct to procrastinate. • Plan. • Wireframe. • Pen and paper can help.
  • 39. Step 2: Getting Started
  • 41. Getting started • This sounds simple, but pick a name for your plugin
  • 42. Getting started • This sounds simple, but pick a name for your plugin • Now pick a “slug” for your plugin
  • 43. Getting started • This sounds simple, but pick a name for your plugin • Now pick a “slug” for your plugin • Check your slug against existing plugins
  • 44. Getting started • This sounds simple, but pick a name for your plugin • Now pick a “slug” for your plugin • Check your slug against existing plugins • Slugs are universally used by WordPress to identify plugins
  • 45. Getting started • This sounds simple, but pick a name for your plugin • Now pick a “slug” for your plugin • Check your slug against existing plugins • Slugs are universally used by WordPress to identify plugins • If you somehow end up with a slug that matches another plugin’s, there will be trouble
  • 46. Getting started • This sounds simple, but pick a name for your plugin • Now pick a “slug” for your plugin • Check your slug against existing plugins • Slugs are universally used by WordPress to identify plugins • If you somehow end up with a slug that matches another plugin’s, there will be trouble • Easy solution: unique slug prefix
  • 47. Getting started (cont.) Plugin Name: LB ColorBox Plugin Slug: lb-colorbox
  • 49. Getting started (cont.) • Read about the plugin submission process at http://wordpress.org/extend/plugins/about/
  • 50. Getting started (cont.) • Read about the plugin submission process at http://wordpress.org/extend/plugins/about/ • Go to http://wordpress.org/extend/plugins/add/
  • 51. Getting started (cont.) • Read about the plugin submission process at http://wordpress.org/extend/plugins/about/ • Go to http://wordpress.org/extend/plugins/add/ • Log in with your WordPress.org account
  • 52. Getting started (cont.) • Read about the plugin submission process at http://wordpress.org/extend/plugins/about/ • Go to http://wordpress.org/extend/plugins/add/ • Log in with your WordPress.org account • Register your new plugin
  • 53. Getting started (cont.) • Read about the plugin submission process at http://wordpress.org/extend/plugins/about/ • Go to http://wordpress.org/extend/plugins/add/ • Log in with your WordPress.org account • Register your new plugin • Name and description are required
  • 54. Getting started (cont.) • Read about the plugin submission process at http://wordpress.org/extend/plugins/about/ • Go to http://wordpress.org/extend/plugins/add/ • Log in with your WordPress.org account • Register your new plugin • Name and description are required • Wait for The Powers That Be to approve your plugin submission
  • 55. Getting started (cont.) • Read about the plugin submission process at http://wordpress.org/extend/plugins/about/ • Go to http://wordpress.org/extend/plugins/add/ • Log in with your WordPress.org account • Register your new plugin • Name and description are required • Wait for The Powers That Be to approve your plugin submission • While you wait...
  • 56. Step 3: Set up your development environment
  • 57. Set up your development environment
  • 58. Set up your development environment • You’ll need a development environment
  • 59. Set up your development environment • You’ll need a development environment • Local?
  • 60. Set up your development environment • You’ll need a development environment • Local? • Remote?
  • 61. Set up your development environment • You’ll need a development environment • Local? • Remote? • Local development environment is preferable
  • 62. Set up your development environment • You’ll need a development environment • Local? • Remote? • Local development environment is preferable • Disconnected development
  • 63. Set up your development environment • You’ll need a development environment • Local? • Remote? • Local development environment is preferable • Disconnected development • No waiting for uploads
  • 64. Set up your development environment • You’ll need a development environment • Local? • Remote? • Local development environment is preferable • Disconnected development • No waiting for uploads • Master of your own domain
  • 65. Set up your development environment (cont.)
  • 66. Set up your development environment (cont.) • Windows
  • 67. Set up your development environment (cont.) • Windows • WAMP (http://www.wampserver.com/en/)
  • 68. Set up your development environment (cont.) • Windows • WAMP (http://www.wampserver.com/en/) • XAMPP (http://www.apachefriends.org/en/xampp-windows.html)
  • 69. Set up your development environment (cont.) • Windows • WAMP (http://www.wampserver.com/en/) • XAMPP (http://www.apachefriends.org/en/xampp-windows.html) • OS X
  • 70. Set up your development environment (cont.) • Windows • WAMP (http://www.wampserver.com/en/) • XAMPP (http://www.apachefriends.org/en/xampp-windows.html) • OS X • MAMP (http://www.mamp.info/en/index.html)
  • 71. Set up your development environment (cont.) • Windows • WAMP (http://www.wampserver.com/en/) • XAMPP (http://www.apachefriends.org/en/xampp-windows.html) • OS X • MAMP (http://www.mamp.info/en/index.html) • XAMPP (http://www.apachefriends.org/en/xampp-macosx.html)
  • 72. Set up your development environment (cont.) • Windows • WAMP (http://www.wampserver.com/en/) • XAMPP (http://www.apachefriends.org/en/xampp-windows.html) • OS X • MAMP (http://www.mamp.info/en/index.html) • XAMPP (http://www.apachefriends.org/en/xampp-macosx.html) • NMPP (http://getmnpp.org/)
  • 73. Set up your development environment (cont.)
  • 74. Set up your development environment (cont.) • Install WordPress
  • 75. Set up your development environment (cont.) • Install WordPress • Create a new directory under [WordPress install directory]/ wp-content/plugins
  • 76. Set up your development environment (cont.) • Install WordPress • Create a new directory under [WordPress install directory]/ wp-content/plugins • Make sure it matches your slug!
  • 78.
  • 80. Skeleton • Let’s put “pen” to “paper”
  • 81. Skeleton • Let’s put “pen” to “paper” • A plugin must have at least the following two files:
  • 82. Skeleton • Let’s put “pen” to “paper” • A plugin must have at least the following two files: • readme.txt
  • 83. Skeleton • Let’s put “pen” to “paper” • A plugin must have at least the following two files: • readme.txt • [plugin-slug].php
  • 86. readme.txt • Full example here: http://wordpress.org/extend/plugins/about/readme.txt
  • 87. readme.txt • Full example here: http://wordpress.org/extend/plugins/about/readme.txt • The important bits are at the top
  • 88. readme.txt • Full example here: http://wordpress.org/extend/plugins/about/readme.txt • The important bits are at the top • Uses a modified Markdown syntax
  • 89. readme.txt • Full example here: http://wordpress.org/extend/plugins/about/readme.txt • The important bits are at the top • Uses a modified Markdown syntax • Contains important information about your theme
  • 90. readme.txt • Full example here: http://wordpress.org/extend/plugins/about/readme.txt • The important bits are at the top • Uses a modified Markdown syntax • Contains important information about your theme • Explicitly controls how your plugin’s WordPress.org directory page looks
  • 91. readme.txt (cont.) This... Text
  • 92. readme.txt (cont.) ...results in this
  • 93. readme.txt (cont.) • WordPress.org has a handy-dandy readme syntax checker: http://wordpress.org/extend/plugins/about/validator/ • Other information displayed • Installation instructions • FAQs • Screenshots • Changelog
  • 95. [plugin-slug].php • Create wp-content/plugins/[plugin-slug]/[plugin-slug].php • Add plugin header information so WordPress knows how to talk about your plugin • Plugin header info defines how WordPress displays your plugin’s info in the Plugins administration screen
  • 97. [plugin-slug].php ...defines this
  • 98. Step 5: Put some meat on those bones
  • 99.
  • 100. Meat
  • 102. Meat • Let’s talk APIs • WordPress core -- http://codex.wordpress.org/Function_Reference
  • 103. Meat • Let’s talk APIs • WordPress core -- http://codex.wordpress.org/Function_Reference • the_title(), get_posts(), add_meta_box(), etc.
  • 104. Meat • Let’s talk APIs • WordPress core -- http://codex.wordpress.org/Function_Reference • the_title(), get_posts(), add_meta_box(), etc. • Plugin API -- http://codex.wordpress.org/Plugin_API
  • 105. Meat (cont.) • Topics for advanced study • Settings API -- http://codex.wordpress.org/Settings_API • Options API -- http://codex.wordpress.org/Options_API • Transients API -- http://codex.wordpress.org/Transients_API • Widgets API -- http://codex.wordpress.org/Widgets_API
  • 106. Meathooks • From the Codex: “Hooks are provided by WordPress to allow your plugin to 'hook into' the rest of WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion.”
  • 108. Meathooks (cont.) • There are two kinds of hooks (again, from the Codex):
  • 109. Meathooks (cont.) • There are two kinds of hooks (again, from the Codex): • “Actions: Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.”
  • 110. Meathooks (cont.) • There are two kinds of hooks (again, from the Codex): • “Actions: Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.” • “Filters: Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Your plugin can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API.”
  • 112. Resources • Codex, Codex, Codex http://codex.wordpress.org • StackExchange http://wordpress.stackexchange.com • WordPress.org forums
  • 113. Useful kickstarts • WordPress Plugin Kickstarter http://wordpress.org/extend/plugins/wordpress-plugin-kickstarter/ • WordPress Plugin Scaffold https://github.com/eteubert/WordPress-Plugin-Scaffold • WordPress Plugin Boilerplate https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate • WordPress Plugin Skeleton https://github.com/lpointet/WordPress-Plugin-Skeleton

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n