SlideShare a Scribd company logo
PLUGIN DEVELOPMENT
                          PRACTICES
    Presented By: Dan Pastori
          @danpastori           521 Dimensions
                                      TECHNOLGY SOLVING NEEDS




Sunday, June 3, 12
Dan Pastori

Sunday, June 3, 12
WHO IS DAN PASTORI?
                           Primary PHP/Java Developer

                          Co-Founded 521 Dimensions


                      Built two large plugins and one theme

                     Been tearing apart Wordpress for 3 years


Sunday, June 3, 12
OTHER PRODUCTS I’VE DEVELOPED FOR




                     And of course custom applications!

Sunday, June 3, 12
WORDPRESS IS THE BEST!
                         (at least from my experience!)

          Great Documentation


          Great Community


           Fast learning curve



Sunday, June 3, 12
PRE-REQUISITES
       Understanding of PHP



      Motivation/Consistency



      A goal to develop towards



Sunday, June 3, 12
WORDPRESS TERMINOLOGY
    2 Types of Hooks:

    1. Filter - Modifies text before it hits the screen.

    2. Action - Hooks launched during execution.




Sunday, June 3, 12
WHERE TO BEGIN?
          1. Find a need
          2. Focus on that need
          3. Prototype
          4. Jump right in

Sunday, June 3, 12
BEGIN YOUR PLUGIN




Sunday, June 3, 12
STRUCTURING PLUGIN
       Create Directories

                     /wp-content/plugins/[NAME]

                     /wp-content/plugins/[NAME]/css

                     /wp-content/plugins/[NAME]/js

                     /wp-content/plugins/[NAME]/images

                     /wp-content/plugins/[NAME]/includes

Sunday, June 3, 12
ADD MAIN FILE
                     /wp-content/plugins/[NAME]/[NAME].php




Sunday, June 3, 12
Add Header In Main File
                     /*
                     Plugin Name: [NAME]
                     Plugin URI: http://www.521dimensions.com/wp-pictures
                     Description: Pictures in Wordpress!
                     Version: 1.0
                     Author: Dan Pastori
                     Author URI: http://www.521dimensions.com
                     License: GPL2
                     */




Sunday, June 3, 12
OOP VS FUNCTIONAL?
                     Modern programming practices say OOP

                                  Both work!




Sunday, June 3, 12
BEGIN CODING!
                     DO NOT OVER-WRITE CORE FUNCTIONALITY


                     Use predefined functions as much as possible
                            (They’re there for a reason!)




Sunday, June 3, 12
What happens when you activate and
               deactivate?

         register_activation_hook(__FILE__, ‘function_name’)

         register_deactivation_hook(__FILE__, ‘function_name’)




Sunday, June 3, 12
Open [NAME].php

   OOP
   ...
   class WPPictures {
       static function install() {
             // do not generate any output here
       }
   }
   register_activation_hook( __FILE__, array('WPPictures', 'install') );


  Functional
   ...
   function wp_pictures_install(){

   }
   register_activation_hook( __FILE__, ‘wp_pictures_install’ );



Sunday, June 3, 12
WORKING WITH THE DATABASE
                     global $wpdb object


                         dbDelta()




Sunday, June 3, 12
INITIAL INSTALL
          1. Check for upgrades
              If {installed version} != {plugin version}
          2. Create Tables

          3. Set options




Sunday, June 3, 12
CSS AND JS
        Register first, enqueue second
       wp_register_script('product_js', plugins_url('/js/
       product_list.js', __FILE__));

      wp_enqueue_script('thickbox',null,array('jquery'));




Sunday, June 3, 12
DASHBOARD VISUAL APPEAL
                One management page, append to settings menu

               Multiple management pages, have it’s own heading




Sunday, June 3, 12
ADMIN MENUS
    add_menu_page(PAGE TITLE, MENU TITLE, PERMISSION, SLUG, FUNCTION, LOGO);

   add_submenu_page(PARENT SLUG, PAGE TITLE, MENU TITLE, 'CAPABILITY', 'MENU SLUG',
'FUNCTION');




Sunday, June 3, 12
MEDIA GALLERY
                     wp_insert_attachment($attachment, $filename,
                                    $parentPostID)




Sunday, June 3, 12
PERMISSIONS
                       current_user_can('manage_options')




               http://codex.wordpress.org/Roles_and_Capabilities

Sunday, June 3, 12
SHORTCODES
        add_shortcode('product-list', 'product_list_shortcode');

       extract( shortcode_atts( array(
                 'categoryID' => 'all',
                    ), $attributes ));




Sunday, June 3, 12
ENSURE PLUGIN QUALITY
                 Be accepting of criticism
                 DOCUMENT... PLEASE :)
                 Update
                 Don’t solve everything, do one thing right




Sunday, June 3, 12
BE THE SERVER ADMIN’S FRIEND
                     (And have a quality plugin)
       Minimize requests

       Make sure your resources are present

       Use common php packages

       Don’t require 777 on ANY directory!




Sunday, June 3, 12
LAUNCH PLUGIN
                        Have your Mom use your plugin


                             Accept criticism

                     Maintain thorough documentation




Sunday, June 3, 12
QUESTIONS?

                       @danpastori




Sunday, June 3, 12

More Related Content

Viewers also liked

My first 3 months working with word press
My first 3 months working with word pressMy first 3 months working with word press
My first 3 months working with word press
Noe Lopez
 
Open Source Entrepreneurship
Open Source EntrepreneurshipOpen Source Entrepreneurship
Open Source Entrepreneurship
Jimmy Rosén
 
how to not design like a developer
how to not design like a developerhow to not design like a developer
how to not design like a developer
tracy apps
 
WordPress in a Time of Crisis
WordPress in a Time of CrisisWordPress in a Time of Crisis
WordPress in a Time of Crisis
Michelle Amaral
 
Wc norrkoping-2015
Wc norrkoping-2015Wc norrkoping-2015
Wc norrkoping-2015
pelmered
 
WordPress & eCommerce - WCLV 2011
WordPress & eCommerce - WCLV 2011WordPress & eCommerce - WCLV 2011
WordPress & eCommerce - WCLV 2011
Shayne Sanderson
 
Optimizing Content Visibility (St. Louis WordCamp)
Optimizing Content Visibility (St. Louis WordCamp)Optimizing Content Visibility (St. Louis WordCamp)
Optimizing Content Visibility (St. Louis WordCamp)
Teresa Lane
 
SEO para Wordpress (WordCamp Salvador)
SEO para Wordpress (WordCamp Salvador)SEO para Wordpress (WordCamp Salvador)
SEO para Wordpress (WordCamp Salvador)
Ian Castro
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
topher1kenobe
 
Options, and Transients, and Theme Mods — Oh my!
Options, and Transients, and Theme Mods — Oh my!Options, and Transients, and Theme Mods — Oh my!
Options, and Transients, and Theme Mods — Oh my!
Konstantin Obenland
 
Customizing the custom loop wordcamp 2012-jeff
Customizing the custom loop   wordcamp 2012-jeffCustomizing the custom loop   wordcamp 2012-jeff
Customizing the custom loop wordcamp 2012-jeff
Alexander Sapountzis
 
Customize your theme using css
Customize your theme using cssCustomize your theme using css
Customize your theme using css
Michael Arestad
 
Introducing the wpXtreme ecosystem
Introducing the wpXtreme ecosystemIntroducing the wpXtreme ecosystem
Introducing the wpXtreme ecosystemGGDBologna
 
Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV
Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV
Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV GGDBologna
 
Leveraging Wordpress for an Ecommerce Website
Leveraging Wordpress for an Ecommerce WebsiteLeveraging Wordpress for an Ecommerce Website
Leveraging Wordpress for an Ecommerce Website
Will Hanke
 
Responsive Images (STL WordCamp 2014)
Responsive Images (STL WordCamp 2014)Responsive Images (STL WordCamp 2014)
Responsive Images (STL WordCamp 2014)
joemcgill
 

Viewers also liked (16)

My first 3 months working with word press
My first 3 months working with word pressMy first 3 months working with word press
My first 3 months working with word press
 
Open Source Entrepreneurship
Open Source EntrepreneurshipOpen Source Entrepreneurship
Open Source Entrepreneurship
 
how to not design like a developer
how to not design like a developerhow to not design like a developer
how to not design like a developer
 
WordPress in a Time of Crisis
WordPress in a Time of CrisisWordPress in a Time of Crisis
WordPress in a Time of Crisis
 
Wc norrkoping-2015
Wc norrkoping-2015Wc norrkoping-2015
Wc norrkoping-2015
 
WordPress & eCommerce - WCLV 2011
WordPress & eCommerce - WCLV 2011WordPress & eCommerce - WCLV 2011
WordPress & eCommerce - WCLV 2011
 
Optimizing Content Visibility (St. Louis WordCamp)
Optimizing Content Visibility (St. Louis WordCamp)Optimizing Content Visibility (St. Louis WordCamp)
Optimizing Content Visibility (St. Louis WordCamp)
 
SEO para Wordpress (WordCamp Salvador)
SEO para Wordpress (WordCamp Salvador)SEO para Wordpress (WordCamp Salvador)
SEO para Wordpress (WordCamp Salvador)
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
 
Options, and Transients, and Theme Mods — Oh my!
Options, and Transients, and Theme Mods — Oh my!Options, and Transients, and Theme Mods — Oh my!
Options, and Transients, and Theme Mods — Oh my!
 
Customizing the custom loop wordcamp 2012-jeff
Customizing the custom loop   wordcamp 2012-jeffCustomizing the custom loop   wordcamp 2012-jeff
Customizing the custom loop wordcamp 2012-jeff
 
Customize your theme using css
Customize your theme using cssCustomize your theme using css
Customize your theme using css
 
Introducing the wpXtreme ecosystem
Introducing the wpXtreme ecosystemIntroducing the wpXtreme ecosystem
Introducing the wpXtreme ecosystem
 
Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV
Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV
Responsività e integrazioni social: l’utente al centro nel nuovo sito Volvo TV
 
Leveraging Wordpress for an Ecommerce Website
Leveraging Wordpress for an Ecommerce WebsiteLeveraging Wordpress for an Ecommerce Website
Leveraging Wordpress for an Ecommerce Website
 
Responsive Images (STL WordCamp 2014)
Responsive Images (STL WordCamp 2014)Responsive Images (STL WordCamp 2014)
Responsive Images (STL WordCamp 2014)
 

Similar to Wordpress Plugin Development Practices

Introduction to Twig
Introduction to TwigIntroduction to Twig
Introduction to Twig
markstory
 
Dapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal ThemesDapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal Themes
killtheliterate
 
Plugin Development Practices
Plugin Development PracticesPlugin Development Practices
Plugin Development Practices
danpastori
 
Wordpress bb-portland
Wordpress bb-portlandWordpress bb-portland
Wordpress bb-portland
AllenSnook
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013
Pablo Godel
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
Vincent Massol
 
3 reasons to contribute to drupal florian loretan (eng)
3 reasons to contribute to drupal florian loretan (eng)3 reasons to contribute to drupal florian loretan (eng)
3 reasons to contribute to drupal florian loretan (eng)
drupalconf
 
Passing a Front end Developer interview
Passing a Front end Developer interview Passing a Front end Developer interview
Passing a Front end Developer interview
tonyfarnsworth
 
Fork cli tool
Fork cli toolFork cli tool
Fork cli tool
jelmersnoeck
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
Pablo Godel
 
Lightweight javaEE with Guice
Lightweight javaEE with GuiceLightweight javaEE with Guice
Lightweight javaEE with Guice
Peerapat Asoktummarungsri
 
Unit Testing in SilverStripe
Unit Testing in SilverStripeUnit Testing in SilverStripe
Unit Testing in SilverStripe
Ingo Schommer
 
Pundit
PunditPundit
Pundit
Net7
 
Drupal for Project Managers, Part 3: Launching
Drupal for Project Managers, Part 3: LaunchingDrupal for Project Managers, Part 3: Launching
Drupal for Project Managers, Part 3: Launching
Acquia
 
Building high performance web apps.
Building high performance web apps.Building high performance web apps.
Building high performance web apps.
Arshak Movsisyan
 
TripCase Unit Testing with Jasmine
TripCase Unit Testing with JasmineTripCase Unit Testing with Jasmine
TripCase Unit Testing with Jasmine
Stephen Pond
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
Ran Mizrahi
 
Html5 apis
Html5 apisHtml5 apis
Html5 apis
Ynon Perek
 
AtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben Speakmon
AtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben SpeakmonAtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben Speakmon
AtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben Speakmon
Atlassian
 
Drupal 8 Plugin API - Manoj K
Drupal 8 Plugin API - Manoj KDrupal 8 Plugin API - Manoj K
Drupal 8 Plugin API - Manoj K
DrupalMumbai
 

Similar to Wordpress Plugin Development Practices (20)

Introduction to Twig
Introduction to TwigIntroduction to Twig
Introduction to Twig
 
Dapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal ThemesDapper Drupal - Custom Tailored Drupal Themes
Dapper Drupal - Custom Tailored Drupal Themes
 
Plugin Development Practices
Plugin Development PracticesPlugin Development Practices
Plugin Development Practices
 
Wordpress bb-portland
Wordpress bb-portlandWordpress bb-portland
Wordpress bb-portland
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
 
3 reasons to contribute to drupal florian loretan (eng)
3 reasons to contribute to drupal florian loretan (eng)3 reasons to contribute to drupal florian loretan (eng)
3 reasons to contribute to drupal florian loretan (eng)
 
Passing a Front end Developer interview
Passing a Front end Developer interview Passing a Front end Developer interview
Passing a Front end Developer interview
 
Fork cli tool
Fork cli toolFork cli tool
Fork cli tool
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
 
Lightweight javaEE with Guice
Lightweight javaEE with GuiceLightweight javaEE with Guice
Lightweight javaEE with Guice
 
Unit Testing in SilverStripe
Unit Testing in SilverStripeUnit Testing in SilverStripe
Unit Testing in SilverStripe
 
Pundit
PunditPundit
Pundit
 
Drupal for Project Managers, Part 3: Launching
Drupal for Project Managers, Part 3: LaunchingDrupal for Project Managers, Part 3: Launching
Drupal for Project Managers, Part 3: Launching
 
Building high performance web apps.
Building high performance web apps.Building high performance web apps.
Building high performance web apps.
 
TripCase Unit Testing with Jasmine
TripCase Unit Testing with JasmineTripCase Unit Testing with Jasmine
TripCase Unit Testing with Jasmine
 
Intro to PHP Testing
Intro to PHP TestingIntro to PHP Testing
Intro to PHP Testing
 
Html5 apis
Html5 apisHtml5 apis
Html5 apis
 
AtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben Speakmon
AtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben SpeakmonAtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben Speakmon
AtlasCamp 2010: The Atlassian Plugin SDK For Fun & Profit - Ben Speakmon
 
Drupal 8 Plugin API - Manoj K
Drupal 8 Plugin API - Manoj KDrupal 8 Plugin API - Manoj K
Drupal 8 Plugin API - Manoj K
 

Recently uploaded

"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
Sease
 

Recently uploaded (20)

"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
 

Wordpress Plugin Development Practices

  • 1. PLUGIN DEVELOPMENT PRACTICES Presented By: Dan Pastori @danpastori 521 Dimensions TECHNOLGY SOLVING NEEDS Sunday, June 3, 12
  • 3. WHO IS DAN PASTORI? Primary PHP/Java Developer Co-Founded 521 Dimensions Built two large plugins and one theme Been tearing apart Wordpress for 3 years Sunday, June 3, 12
  • 4. OTHER PRODUCTS I’VE DEVELOPED FOR And of course custom applications! Sunday, June 3, 12
  • 5. WORDPRESS IS THE BEST! (at least from my experience!) Great Documentation Great Community Fast learning curve Sunday, June 3, 12
  • 6. PRE-REQUISITES Understanding of PHP Motivation/Consistency A goal to develop towards Sunday, June 3, 12
  • 7. WORDPRESS TERMINOLOGY 2 Types of Hooks: 1. Filter - Modifies text before it hits the screen. 2. Action - Hooks launched during execution. Sunday, June 3, 12
  • 8. WHERE TO BEGIN? 1. Find a need 2. Focus on that need 3. Prototype 4. Jump right in Sunday, June 3, 12
  • 10. STRUCTURING PLUGIN Create Directories /wp-content/plugins/[NAME] /wp-content/plugins/[NAME]/css /wp-content/plugins/[NAME]/js /wp-content/plugins/[NAME]/images /wp-content/plugins/[NAME]/includes Sunday, June 3, 12
  • 11. ADD MAIN FILE /wp-content/plugins/[NAME]/[NAME].php Sunday, June 3, 12
  • 12. Add Header In Main File /* Plugin Name: [NAME] Plugin URI: http://www.521dimensions.com/wp-pictures Description: Pictures in Wordpress! Version: 1.0 Author: Dan Pastori Author URI: http://www.521dimensions.com License: GPL2 */ Sunday, June 3, 12
  • 13. OOP VS FUNCTIONAL? Modern programming practices say OOP Both work! Sunday, June 3, 12
  • 14. BEGIN CODING! DO NOT OVER-WRITE CORE FUNCTIONALITY Use predefined functions as much as possible (They’re there for a reason!) Sunday, June 3, 12
  • 15. What happens when you activate and deactivate? register_activation_hook(__FILE__, ‘function_name’) register_deactivation_hook(__FILE__, ‘function_name’) Sunday, June 3, 12
  • 16. Open [NAME].php OOP ... class WPPictures { static function install() { // do not generate any output here } } register_activation_hook( __FILE__, array('WPPictures', 'install') ); Functional ... function wp_pictures_install(){ } register_activation_hook( __FILE__, ‘wp_pictures_install’ ); Sunday, June 3, 12
  • 17. WORKING WITH THE DATABASE global $wpdb object dbDelta() Sunday, June 3, 12
  • 18. INITIAL INSTALL 1. Check for upgrades If {installed version} != {plugin version} 2. Create Tables 3. Set options Sunday, June 3, 12
  • 19. CSS AND JS Register first, enqueue second wp_register_script('product_js', plugins_url('/js/ product_list.js', __FILE__)); wp_enqueue_script('thickbox',null,array('jquery')); Sunday, June 3, 12
  • 20. DASHBOARD VISUAL APPEAL One management page, append to settings menu Multiple management pages, have it’s own heading Sunday, June 3, 12
  • 21. ADMIN MENUS add_menu_page(PAGE TITLE, MENU TITLE, PERMISSION, SLUG, FUNCTION, LOGO); add_submenu_page(PARENT SLUG, PAGE TITLE, MENU TITLE, 'CAPABILITY', 'MENU SLUG', 'FUNCTION'); Sunday, June 3, 12
  • 22. MEDIA GALLERY wp_insert_attachment($attachment, $filename, $parentPostID) Sunday, June 3, 12
  • 23. PERMISSIONS current_user_can('manage_options') http://codex.wordpress.org/Roles_and_Capabilities Sunday, June 3, 12
  • 24. SHORTCODES add_shortcode('product-list', 'product_list_shortcode'); extract( shortcode_atts( array( 'categoryID' => 'all', ), $attributes )); Sunday, June 3, 12
  • 25. ENSURE PLUGIN QUALITY Be accepting of criticism DOCUMENT... PLEASE :) Update Don’t solve everything, do one thing right Sunday, June 3, 12
  • 26. BE THE SERVER ADMIN’S FRIEND (And have a quality plugin) Minimize requests Make sure your resources are present Use common php packages Don’t require 777 on ANY directory! Sunday, June 3, 12
  • 27. LAUNCH PLUGIN Have your Mom use your plugin Accept criticism Maintain thorough documentation Sunday, June 3, 12
  • 28. QUESTIONS? @danpastori Sunday, June 3, 12