SlideShare a Scribd company logo
Hi, my name is Topher
I’m a WordPress developer from
Grand Rapids MI
@topher1kenobe
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Intro To Plugin
Development
Emptying out functions.php
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
“Just put this code in your theme’s
functions.php file…”
JUST SAY NO
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Plugins are packages of code that
affect your site’s functionality.
Themes are packages of code that
affect your site’s design.
DO NOT MIX.
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Plugins are either single files or
folders in /wp-content/plugins
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Typically inside each plugin folder is a file
with the same name as the folder, plus any
other files it needs.
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
In the top of every main plugin file is a header
block with information about the plugin.
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
The only option absolutely required is the
“Plugin Name”. The others are merely
strongly recommended.
VERY strongly recommended:
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: custom-header, custom-menu, editor-style,
featured-images (etc)
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
The Secret Sauce:
Any code you might have put into
functions.php in your theme could
go into a plugin.*
*with a few exceptions
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Example:
<?php
/*
Plugin Name: Topher’s Little Plugin
Description: Does things I want to my site
Version: 1.0
Author: Topher
*/
// 220 pixels wide by 180 pixels tall, hard crop mode
add_image_size( 'custom-size', 220, 180, true );
?> Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Longer Example:
<?php
/*
Plugin Name: Topher’s Little Plugin
Description: Does things I want to my site
Version: 1.0
Author: Topher
*/
// 220 pixels wide by 180 pixels tall, hard crop mode
add_image_size( 'custom-size', 220, 180, true );
// Make shortcodes work inside text widgets
add_filter('widget_text', 'do_shortcode');
// Fix styling in old content
function phlog_scripts() {
wp_enqueue_style( 'phlog_styles', plugins_url( '/css/phlog.css' , __FILE__ ) );
}
add_action( 'wp_enqueue_scripts', 'phlog_scripts' );
?> Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Explanation:
function phlog_scripts() {
wp_enqueue_style( 'phlog_styles', plugins_url( '/css/phlog.css' , __FILE__ ) );
}
add_action( 'wp_enqueue_scripts', 'phlog_scripts' );
I made a function called `phlog_scripts()`
Inside it is a function that properly enqueues a CSS file.
wp_enqueue_style takes 2 arguments, a name I made up and the path
to the CSS file.
The path to the CSS file is determined with the WordPress function
plugins_url().
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Releasing a Plugin
A plugin built for release on WordPress.org must meet a list of
requirements. The requirements are listed at
https://developer.wordpress.org/plugins/wordpress-org/
Best practices are found in the WordPress Plugin Handbook
https://developer.wordpress.org/plugins/
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
mu-plugins
mu == must use
Plugins that are stored in mu-plugins are automatically activated, and
cannot be deactivated.
The main file of a plugin must be stored directly in the /mu-plugins/
directory, OR be included.
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
mu-plugins
To convert a regular plugin to mu-plugins, put it in the /mu-plugins
directory and then make a new, single-file plugin that looks like this:
<?php
/*
Plugin Name: mu-plugins inclusion plugin
Description: Simply includes the main files of any plugins that are in mu-plugins
Author: Topher
Version: 1.0
*/
// include widget_logic
include WP_CONTENT_DIR . '/mu-plugins/widget-logic/widget_logic.php';
?>
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
Extra Credit: WP-CLI
WP-CLI is the command line tool for WordPress. It can create an
empty plugin with the proper header in place:
wp scaffold plugin --prompt
This will ask questions like this:
1/4 <slug>: topher-test
2/4 [--plugin_name=<title>]: Topher's Test
3/4 [--skip-tests] (Y/n): Y
4/4 [--activate] (Y/n): Y
Success: Created /home/topher1/topher1kenobe.com/wp-content/plugins/topher-test
1/1 <plugin>: topher-test
Success: Created test files.
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
THANKS FOR
LISTENING
Intro To Plugin Development
Topher DeRosia
@topher1kenobe
http://topher1kenobe.com
Follow me @topher1kenobe

More Related Content

What's hot

CakePHP - Admin Acl Controlled
CakePHP - Admin Acl ControlledCakePHP - Admin Acl Controlled
CakePHP - Admin Acl Controlled
Luís Fred
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
Dougal Campbell
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architecture
ondrejbalas
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress Theme
Adam Darowski
 
Play with Alfresco ADF 2.0.0 Angular
Play with Alfresco ADF 2.0.0 AngularPlay with Alfresco ADF 2.0.0 Angular
Play with Alfresco ADF 2.0.0 Angular
Eugenio Romano
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
Tareq Hasan
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
Sitdhibong Laokok
 
Installation of Joomla on Windows XP
Installation of Joomla on Windows XPInstallation of Joomla on Windows XP
Installation of Joomla on Windows XP
Rupesh Kumar
 
Top 50 Interview Questions and Answers in CakePHP
Top 50 Interview Questions and Answers in CakePHPTop 50 Interview Questions and Answers in CakePHP
Top 50 Interview Questions and Answers in CakePHP
Ketan Patel
 
Wordpress Hacks: When a "Hacker" Becomes a Hero
Wordpress Hacks: When a "Hacker" Becomes a HeroWordpress Hacks: When a "Hacker" Becomes a Hero
Wordpress Hacks: When a "Hacker" Becomes a Hero
Aban Nesta
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
Thad Allender
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
Steve Mortiboy
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
Anthony Montalbano
 
Ako na vlastne WP temy
Ako na vlastne WP temyAko na vlastne WP temy
Ako na vlastne WP temy
Juraj Kiss
 
Extending WordPress
Extending WordPressExtending WordPress
Extending WordPress
Jonathan Bossenger
 
Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016
Ian Wilson
 
Drupal Theme Development
Drupal Theme DevelopmentDrupal Theme Development
Drupal Theme Development
Web Development Montreal
 
WordPress Theme & Plugin i18n & L10n
WordPress Theme & Plugin i18n & L10nWordPress Theme & Plugin i18n & L10n
WordPress Theme & Plugin i18n & L10n
codebangla
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
markparolisi
 
Html5
Html5Html5

What's hot (20)

CakePHP - Admin Acl Controlled
CakePHP - Admin Acl ControlledCakePHP - Admin Acl Controlled
CakePHP - Admin Acl Controlled
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architecture
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress Theme
 
Play with Alfresco ADF 2.0.0 Angular
Play with Alfresco ADF 2.0.0 AngularPlay with Alfresco ADF 2.0.0 Angular
Play with Alfresco ADF 2.0.0 Angular
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
 
Installation of Joomla on Windows XP
Installation of Joomla on Windows XPInstallation of Joomla on Windows XP
Installation of Joomla on Windows XP
 
Top 50 Interview Questions and Answers in CakePHP
Top 50 Interview Questions and Answers in CakePHPTop 50 Interview Questions and Answers in CakePHP
Top 50 Interview Questions and Answers in CakePHP
 
Wordpress Hacks: When a "Hacker" Becomes a Hero
Wordpress Hacks: When a "Hacker" Becomes a HeroWordpress Hacks: When a "Hacker" Becomes a Hero
Wordpress Hacks: When a "Hacker" Becomes a Hero
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
 
Ako na vlastne WP temy
Ako na vlastne WP temyAko na vlastne WP temy
Ako na vlastne WP temy
 
Extending WordPress
Extending WordPressExtending WordPress
Extending WordPress
 
Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016
 
Drupal Theme Development
Drupal Theme DevelopmentDrupal Theme Development
Drupal Theme Development
 
WordPress Theme & Plugin i18n & L10n
WordPress Theme & Plugin i18n & L10nWordPress Theme & Plugin i18n & L10n
WordPress Theme & Plugin i18n & L10n
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Html5
Html5Html5
Html5
 

Viewers also liked

Financial Scope
Financial ScopeFinancial Scope
Financial Scope
Manu Thakur
 
Literary Genres Pp Presentation
Literary Genres Pp PresentationLiterary Genres Pp Presentation
Literary Genres Pp Presentation
Adriana Sanchez
 
Presentation on Equity Analysis
Presentation on Equity AnalysisPresentation on Equity Analysis
Presentation on Equity Analysis
Manu Thakur
 
U2 Exam 2007 Freedom Project
U2 Exam 2007 Freedom ProjectU2 Exam 2007 Freedom Project
U2 Exam 2007 Freedom Project
Z Hoeben
 
A&c workshop outcomes
A&c workshop outcomesA&c workshop outcomes
A&c workshop outcomes
Z Hoeben
 
Pp Presentation Guide
Pp Presentation GuidePp Presentation Guide
Pp Presentation Guide
Z Hoeben
 
Building on Community Resilience in Post-earthquake Nepal
Building on Community Resilience in Post-earthquake NepalBuilding on Community Resilience in Post-earthquake Nepal
Building on Community Resilience in Post-earthquake Nepal
Kenny Meesters
 
Equity analysis
Equity analysisEquity analysis
Equity analysis
Partha Sinha
 
NGOs In Nepal | NGOs Directory
NGOs In Nepal | NGOs DirectoryNGOs In Nepal | NGOs Directory
NGOs In Nepal | NGOs Directory
shubham ghimire
 
organisational development ppt
organisational development pptorganisational development ppt
organisational development ppt
kohlisudeep18
 
Organizational Development
Organizational DevelopmentOrganizational Development
Organizational Development
Dr. Pratiksha Patil
 

Viewers also liked (11)

Financial Scope
Financial ScopeFinancial Scope
Financial Scope
 
Literary Genres Pp Presentation
Literary Genres Pp PresentationLiterary Genres Pp Presentation
Literary Genres Pp Presentation
 
Presentation on Equity Analysis
Presentation on Equity AnalysisPresentation on Equity Analysis
Presentation on Equity Analysis
 
U2 Exam 2007 Freedom Project
U2 Exam 2007 Freedom ProjectU2 Exam 2007 Freedom Project
U2 Exam 2007 Freedom Project
 
A&c workshop outcomes
A&c workshop outcomesA&c workshop outcomes
A&c workshop outcomes
 
Pp Presentation Guide
Pp Presentation GuidePp Presentation Guide
Pp Presentation Guide
 
Building on Community Resilience in Post-earthquake Nepal
Building on Community Resilience in Post-earthquake NepalBuilding on Community Resilience in Post-earthquake Nepal
Building on Community Resilience in Post-earthquake Nepal
 
Equity analysis
Equity analysisEquity analysis
Equity analysis
 
NGOs In Nepal | NGOs Directory
NGOs In Nepal | NGOs DirectoryNGOs In Nepal | NGOs Directory
NGOs In Nepal | NGOs Directory
 
organisational development ppt
organisational development pptorganisational development ppt
organisational development ppt
 
Organizational Development
Organizational DevelopmentOrganizational Development
Organizational Development
 

Similar to Introduction to WordPress Plugin Development, WordCamp North Canton, 2015

Intro to Plugin Development, Miami WordCamp, 2015
Intro to Plugin Development, Miami WordCamp, 2015Intro to Plugin Development, Miami WordCamp, 2015
Intro to Plugin Development, Miami WordCamp, 2015
topher1kenobe
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
Brad Williams
 
Word press Plugins by WordPress Experts
Word press Plugins by WordPress ExpertsWord press Plugins by WordPress Experts
Word press Plugins by WordPress Experts
Yameen Khan
 
WordPress Plugins
WordPress PluginsWordPress Plugins
Plugin development demystified 2017
Plugin development demystified 2017Plugin development demystified 2017
Plugin development demystified 2017
ylefebvre
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
Mainak Goswami
 
Wordpress Custom Child theme
Wordpress Custom Child themeWordpress Custom Child theme
Wordpress Custom Child theme
YouSaf HasSan
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
LinnAlexandra
 
How to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginHow to Create a Custom WordPress Plugin
How to Create a Custom WordPress Plugin
Andolasoft Inc
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
Chandra Prakash Thapa
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
Zero Point Development
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
David Bisset
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
certainstrings
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
certainstrings
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
Brendan Sera-Shriar
 
Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010
Brad Williams
 
5 Steps to Develop a WordPress Plugin From Scratch.pdf
5 Steps to Develop a WordPress Plugin From Scratch.pdf5 Steps to Develop a WordPress Plugin From Scratch.pdf
5 Steps to Develop a WordPress Plugin From Scratch.pdf
BeePlugin
 
How does get template part works in twenty ten theme
How does get template part works in twenty ten themeHow does get template part works in twenty ten theme
How does get template part works in twenty ten theme
mohd rozani abd ghani
 
How To Write a WordPress Plugin
How To Write a WordPress PluginHow To Write a WordPress Plugin
How To Write a WordPress Plugin
Andy Stratton
 
advance theme development
advance theme developmentadvance theme development
advance theme development
1amitgupta
 

Similar to Introduction to WordPress Plugin Development, WordCamp North Canton, 2015 (20)

Intro to Plugin Development, Miami WordCamp, 2015
Intro to Plugin Development, Miami WordCamp, 2015Intro to Plugin Development, Miami WordCamp, 2015
Intro to Plugin Development, Miami WordCamp, 2015
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
Word press Plugins by WordPress Experts
Word press Plugins by WordPress ExpertsWord press Plugins by WordPress Experts
Word press Plugins by WordPress Experts
 
WordPress Plugins
WordPress PluginsWordPress Plugins
WordPress Plugins
 
Plugin development demystified 2017
Plugin development demystified 2017Plugin development demystified 2017
Plugin development demystified 2017
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
 
Wordpress Custom Child theme
Wordpress Custom Child themeWordpress Custom Child theme
Wordpress Custom Child theme
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 
How to Create a Custom WordPress Plugin
How to Create a Custom WordPress PluginHow to Create a Custom WordPress Plugin
How to Create a Custom WordPress Plugin
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
 
Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010
 
5 Steps to Develop a WordPress Plugin From Scratch.pdf
5 Steps to Develop a WordPress Plugin From Scratch.pdf5 Steps to Develop a WordPress Plugin From Scratch.pdf
5 Steps to Develop a WordPress Plugin From Scratch.pdf
 
How does get template part works in twenty ten theme
How does get template part works in twenty ten themeHow does get template part works in twenty ten theme
How does get template part works in twenty ten theme
 
How To Write a WordPress Plugin
How To Write a WordPress PluginHow To Write a WordPress Plugin
How To Write a WordPress Plugin
 
advance theme development
advance theme developmentadvance theme development
advance theme development
 

More from topher1kenobe

How To Increase Ecommerce Conversions
How To Increase Ecommerce ConversionsHow To Increase Ecommerce Conversions
How To Increase Ecommerce Conversions
topher1kenobe
 
Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...
Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...
Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...
topher1kenobe
 
Build Ecommerce Sites With Confidence (Demystifying Ecommerce)
Build Ecommerce Sites With Confidence (Demystifying Ecommerce)Build Ecommerce Sites With Confidence (Demystifying Ecommerce)
Build Ecommerce Sites With Confidence (Demystifying Ecommerce)
topher1kenobe
 
6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...
6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...
6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...
topher1kenobe
 
Introduction to the WordPress Transients API
Introduction to the WordPress Transients APIIntroduction to the WordPress Transients API
Introduction to the WordPress Transients API
topher1kenobe
 
Talking to Other Sites with the WP HTTP API
Talking to Other Sites with the WP HTTP APITalking to Other Sites with the WP HTTP API
Talking to Other Sites with the WP HTTP API
topher1kenobe
 
What’s a REST API and why should I care?
What’s a REST API and why should I care?What’s a REST API and why should I care?
What’s a REST API and why should I care?
topher1kenobe
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
topher1kenobe
 
HeroPress: A Case Study
HeroPress: A Case StudyHeroPress: A Case Study
HeroPress: A Case Study
topher1kenobe
 
Custom Database Queries in WordPress
Custom Database Queries in WordPressCustom Database Queries in WordPress
Custom Database Queries in WordPress
topher1kenobe
 
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
topher1kenobe
 
WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to EverythingWordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
topher1kenobe
 
Command Line Awesome, WordCamp Grand Rapids 2014
Command Line Awesome, WordCamp Grand Rapids 2014Command Line Awesome, WordCamp Grand Rapids 2014
Command Line Awesome, WordCamp Grand Rapids 2014
topher1kenobe
 

More from topher1kenobe (13)

How To Increase Ecommerce Conversions
How To Increase Ecommerce ConversionsHow To Increase Ecommerce Conversions
How To Increase Ecommerce Conversions
 
Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...
Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...
Build Ecommerce Sites With Confidence (Demystifying Ecommerce), WordCamp Los ...
 
Build Ecommerce Sites With Confidence (Demystifying Ecommerce)
Build Ecommerce Sites With Confidence (Demystifying Ecommerce)Build Ecommerce Sites With Confidence (Demystifying Ecommerce)
Build Ecommerce Sites With Confidence (Demystifying Ecommerce)
 
6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...
6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...
6 Ecommerce Trends Altering the Ecommerce Landscape, and changing which strat...
 
Introduction to the WordPress Transients API
Introduction to the WordPress Transients APIIntroduction to the WordPress Transients API
Introduction to the WordPress Transients API
 
Talking to Other Sites with the WP HTTP API
Talking to Other Sites with the WP HTTP APITalking to Other Sites with the WP HTTP API
Talking to Other Sites with the WP HTTP API
 
What’s a REST API and why should I care?
What’s a REST API and why should I care?What’s a REST API and why should I care?
What’s a REST API and why should I care?
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
 
HeroPress: A Case Study
HeroPress: A Case StudyHeroPress: A Case Study
HeroPress: A Case Study
 
Custom Database Queries in WordPress
Custom Database Queries in WordPressCustom Database Queries in WordPress
Custom Database Queries in WordPress
 
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
Introduction to WordPress Child Theming, WordCamp Kansas City, 2015
 
WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to EverythingWordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
WordCamp Ann Arbor 2014: Site Caching, From Nothing to Everything
 
Command Line Awesome, WordCamp Grand Rapids 2014
Command Line Awesome, WordCamp Grand Rapids 2014Command Line Awesome, WordCamp Grand Rapids 2014
Command Line Awesome, WordCamp Grand Rapids 2014
 

Recently uploaded

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
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
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
jpupo2018
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
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
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 

Recently uploaded (20)

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
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
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
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)
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 

Introduction to WordPress Plugin Development, WordCamp North Canton, 2015

  • 1. Hi, my name is Topher I’m a WordPress developer from Grand Rapids MI @topher1kenobe Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 2. Intro To Plugin Development Emptying out functions.php Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 3. “Just put this code in your theme’s functions.php file…” JUST SAY NO Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 4. Plugins are packages of code that affect your site’s functionality. Themes are packages of code that affect your site’s design. DO NOT MIX. Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 5. Plugins are either single files or folders in /wp-content/plugins Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 6. Typically inside each plugin folder is a file with the same name as the folder, plus any other files it needs. Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 7. In the top of every main plugin file is a header block with information about the plugin. Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 8. The only option absolutely required is the “Plugin Name”. The others are merely strongly recommended. VERY strongly recommended: License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: custom-header, custom-menu, editor-style, featured-images (etc) Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 9. The Secret Sauce: Any code you might have put into functions.php in your theme could go into a plugin.* *with a few exceptions Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 10. Example: <?php /* Plugin Name: Topher’s Little Plugin Description: Does things I want to my site Version: 1.0 Author: Topher */ // 220 pixels wide by 180 pixels tall, hard crop mode add_image_size( 'custom-size', 220, 180, true ); ?> Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 11. Longer Example: <?php /* Plugin Name: Topher’s Little Plugin Description: Does things I want to my site Version: 1.0 Author: Topher */ // 220 pixels wide by 180 pixels tall, hard crop mode add_image_size( 'custom-size', 220, 180, true ); // Make shortcodes work inside text widgets add_filter('widget_text', 'do_shortcode'); // Fix styling in old content function phlog_scripts() { wp_enqueue_style( 'phlog_styles', plugins_url( '/css/phlog.css' , __FILE__ ) ); } add_action( 'wp_enqueue_scripts', 'phlog_scripts' ); ?> Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 12. Explanation: function phlog_scripts() { wp_enqueue_style( 'phlog_styles', plugins_url( '/css/phlog.css' , __FILE__ ) ); } add_action( 'wp_enqueue_scripts', 'phlog_scripts' ); I made a function called `phlog_scripts()` Inside it is a function that properly enqueues a CSS file. wp_enqueue_style takes 2 arguments, a name I made up and the path to the CSS file. The path to the CSS file is determined with the WordPress function plugins_url(). Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 13. Releasing a Plugin A plugin built for release on WordPress.org must meet a list of requirements. The requirements are listed at https://developer.wordpress.org/plugins/wordpress-org/ Best practices are found in the WordPress Plugin Handbook https://developer.wordpress.org/plugins/ Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 14. mu-plugins mu == must use Plugins that are stored in mu-plugins are automatically activated, and cannot be deactivated. The main file of a plugin must be stored directly in the /mu-plugins/ directory, OR be included. Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 15. mu-plugins To convert a regular plugin to mu-plugins, put it in the /mu-plugins directory and then make a new, single-file plugin that looks like this: <?php /* Plugin Name: mu-plugins inclusion plugin Description: Simply includes the main files of any plugins that are in mu-plugins Author: Topher Version: 1.0 */ // include widget_logic include WP_CONTENT_DIR . '/mu-plugins/widget-logic/widget_logic.php'; ?> Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 16. Extra Credit: WP-CLI WP-CLI is the command line tool for WordPress. It can create an empty plugin with the proper header in place: wp scaffold plugin --prompt This will ask questions like this: 1/4 <slug>: topher-test 2/4 [--plugin_name=<title>]: Topher's Test 3/4 [--skip-tests] (Y/n): Y 4/4 [--activate] (Y/n): Y Success: Created /home/topher1/topher1kenobe.com/wp-content/plugins/topher-test 1/1 <plugin>: topher-test Success: Created test files. Intro To Plugin Development Topher DeRosia @topher1kenobe
  • 17. THANKS FOR LISTENING Intro To Plugin Development Topher DeRosia @topher1kenobe http://topher1kenobe.com Follow me @topher1kenobe