Skip to content

Instantly share code, notes, and snippets.

@stevegrunwell
Created July 14, 2012 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevegrunwell/3112439 to your computer and use it in GitHub Desktop.
Save stevegrunwell/3112439 to your computer and use it in GitHub Desktop.
Creating a Plugin Workshop - WordCamp Columbus 2012

Creating a Plugin Workshop

July 14, 2012

Instructor: Nowell VanHoesen (@NowellVanHoesen)

Requirements

Location

By default, plugins are in wp-content/plugins/, but this can be changed

Naming

Be sure to have a unique name to avoid conflicts with other plugins

Files

Plugins can function as single files in the plugin directory root

Would this approach (single file) prevent plugins from being part of the WordPress plugin repo? It wouldn't have a readme file...

Best Practices

  • Coding
    • Comment as much as possible. Besides just being smart coding, it'll help people who might modify your code
    • Code indentation: use it
  • Utilize what's there - don't create new tables or add functionality if it already exists within WordPress
  • Only load JS, CSS, and external libraries when it's needed
  • Provide feedback - tell people when it's not working
  • Use security nonces to help protect the site from XSS
  • Don't hardcode plugin URLs (which will break if plugins are installed in a non-standard location) - use plugins_url() instead (Codex)

Resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment