Slide 1

Slide 1 text

WordPress Mumbai

Slide 2

Slide 2 text

Introduction To Plugin Development

Slide 3

Slide 3 text

EXPECTATIONS & TAKEAWAYS

Slide 4

Slide 4 text

PLUGINS

Slide 5

Slide 5 text

Why Plugins ?

Slide 6

Slide 6 text

Types Of Plugins ?

Slide 7

Slide 7 text

Types Of Plugins ? Functionality Enhancement Site Specific Plugin

Slide 8

Slide 8 text

Plugin vs Theme Territory !

Slide 9

Slide 9 text

LICENSING

Slide 10

Slide 10 text

Why its important?

Slide 11

Slide 11 text

Why its important ? Permissions Conditions Limitations

Slide 12

Slide 12 text

Resources

Slide 13

Slide 13 text

Resources https://choosealicense.com/licenses/

Slide 14

Slide 14 text

Resources https://opensource.org/licenses

Slide 15

Slide 15 text

Resources https://en.wikipedia.org/wiki/Comparison_of_free_and_open-source_software_licenses

Slide 16

Slide 16 text

DEVELOPMENT ENVIRONMENT

Slide 17

Slide 17 text

Development Stack

Slide 18

Slide 18 text

WAMP XAMPP MAMP Varying Vagrant Vagrants

Slide 19

Slide 19 text

Code Editor

Slide 20

Slide 20 text

SublimeText Atom Brackets NotePad++ TextWrangler

Slide 21

Slide 21 text

Source Control

Slide 22

Slide 22 text

Local Git GitHub GitLab

Slide 23

Slide 23 text

RESOURCES

Slide 24

Slide 24 text

Developer Handbook https://developer.wordpress.org/plugins/

Slide 25

Slide 25 text

WordPress TV http://wordpress.tv/?s=plugin

Slide 26

Slide 26 text

Developer Reference https://developer.wordpress.org/reference/

Slide 27

Slide 27 text

Generate WP http://generatewp.com

Slide 28

Slide 28 text

Patterns https://github.com/0aveRyan/patterns

Slide 29

Slide 29 text

Custom Meta Boxes https://github.com/humanmade/Custom-Meta-Boxes

Slide 30

Slide 30 text

GETTING STARTED

Slide 31

Slide 31 text

Procedural? Oops? Boilerplate?

Slide 32

Slide 32 text

Plan & Move Accordingly

Slide 33

Slide 33 text

BASIC PLUGIN

Slide 34

Slide 34 text

Basic Structure my-plugin my-plugin.php readme.txt license.txt

Slide 35

Slide 35 text

Plugin Header

Slide 36

Slide 36 text

Plugin Header my-plugin.php

Slide 37

Slide 37 text

Hooks Activation Deactivation Uninstall

Slide 38

Slide 38 text

Hooks Activation/Deactivation/Uninstall

Slide 39

Slide 39 text

BEST PRACTICES

Slide 40

Slide 40 text

File Organization

Slide 41

Slide 41 text

Follow WordPress Design

Slide 42

Slide 42 text

Coding Standards

Slide 43

Slide 43 text

Avoid Naming Collisions

Slide 44

Slide 44 text

o Prefix everything o Check for Existing Implementations o Variables: isset() (includes arrays, objects, etc.) o Functions: function_exists() o Classes: class_exists() o Constants: defined()

Slide 45

Slide 45 text

Conditional Loading

Slide 46

Slide 46 text

Plugin Architecture

Slide 47

Slide 47 text

Boilerplate Starting Points

Slide 48

Slide 48 text

Components Of Plugin Development

Slide 49

Slide 49 text

SECURITY

Slide 50

Slide 50 text

Checking User Capabilities

Slide 51

Slide 51 text

Data Validation

Slide 52

Slide 52 text

Securing Input & Output

Slide 53

Slide 53 text

Nonces

Slide 54

Slide 54 text

HOOKS

Slide 55

Slide 55 text

What are hooks ?

Slide 56

Slide 56 text

Types Of Hooks

Slide 57

Slide 57 text

Action Filter

Slide 58

Slide 58 text

Custom Hooks

Slide 59

Slide 59 text

Why Custom Hooks?

Slide 60

Slide 60 text

ADMIN MENU

Slide 61

Slide 61 text

Top Level Menu

Slide 62

Slide 62 text

Sub Menu

Slide 63

Slide 63 text

SHORTCODES

Slide 64

Slide 64 text

Why Shortcodes?

Slide 65

Slide 65 text

Default Shortcodes

Slide 66

Slide 66 text

[caption] – shortcode that allows you to wrap captions around content [gallery] – shortcode that allows you to show image galleries [audio] – shortcode that allows you to embed and play audio files [video] – shortcode that allows you to embed and play video files [playlist] – shortcode that allows you to display collection of audio or video files [embed] – shortcode that allows you to wrap embedded items

Slide 67

Slide 67 text

Basic Shortcodes [wporg] is your new shortcode. The use of the shortcode will trigger the wporg_shortcode callback function.

Slide 68

Slide 68 text

Enclosing Shortcodes [wporg]content to manipulate[/wporg]

Slide 69

Slide 69 text

Shortcodes With Parameters [wporg title="WordPress.org"]content to manipulate[/wporg]

Slide 70

Slide 70 text

SETTINGS

Slide 71

Slide 71 text

Settings

Slide 72

Slide 72 text

Settings API

Slide 73

Slide 73 text

Options API

Slide 74

Slide 74 text

Why we need settings API?

Slide 75

Slide 75 text

METADATA

Slide 76

Slide 76 text

What is Metadata?

Slide 77

Slide 77 text

Managing MetaData add_post_meta() update_post_meta() delete_post_meta() get_post_meta()

Slide 78

Slide 78 text

Meta Boxes

Slide 79

Slide 79 text

Custom Meta Boxes

Slide 80

Slide 80 text

CUSTOM POSTTYPES

Slide 81

Slide 81 text

What is posttype?

Slide 82

Slide 82 text

Default PostTypes Post Page Attachment Revision Menu

Slide 83

Slide 83 text

What is custom posttypes?

Slide 84

Slide 84 text

Custom PostType

Slide 85

Slide 85 text

TAXANOMIES

Slide 86

Slide 86 text

What is Taxonomy?

Slide 87

Slide 87 text

Default Taxonomies

Slide 88

Slide 88 text

Custom Taxonomies

Slide 89

Slide 89 text

WORDPRESS.ORG

Slide 90

Slide 90 text

Hosting not source control

Slide 91

Slide 91 text

Important things to consider

Slide 92

Slide 92 text

readme.txt

Slide 93

Slide 93 text

Readme.txt > WordPress.org

Slide 94

Slide 94 text

Plugin Submission https://wordpress.org/plugins/developers/add/

Slide 95

Slide 95 text

What next ?

Slide 96

Slide 96 text

Advanced Topics ACL (Access Control List) HTTP API WP Cron Internationalisation & Localisation

Slide 97

Slide 97 text

Thank You