Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started with WordPress Development

Getting Started with WordPress Development

WordPress is an incredibly powerful platform and framework for development, but until you learn how to use it you won't be able to make full use of its flexibility. In this session you will learn the core principles of WordPress development that will enable you to start taking full advantage of everything that it offers.

This presentation is aimed at experienced PHP developers who have minimal experience with WordPress development. It was presented at the Cape Town PHP Meetup on 23 April 2015: http://www.meetup.com/Cape-Town-PHP-Group/events/221748419/

The full video of the presentation is available here: https://www.youtube.com/watch?v=JbEgsygOxKU

51eec74fdf430271ce134e58b811e5b9?s=128

Hugh Lashbrooke

April 23, 2015
Tweet

More Decks by Hugh Lashbrooke

Other Decks in Technology

Transcript

  1. Getting Started With WordPress Development

  2. HTML PHP MVC WP

  3. None
  4. None
  5. Folder Structure Headers Events Plugin Development

  6. wp-content/plugins/plugin-slug plugin-slug.php readme.txt Folder Structure

  7. Headers /* * Plugin Name: Seriously Simple Podcasting * Version:

    1.9.6 * Plugin URI: https://wordpress.org/plugins/seriously-simple-podcasting/ * Description: Podcasting the way it's meant to be. * Author: Hugh Lashbrooke * Author URI: http://www.hughlashbrooke.com/ * Requires at least: 4.0 * Tested up to: 4.2 * * Text Domain: seriously-simple-podcasting * Domain Path: /lang/ */
  8. PHP call_user_func() WordPress do_action() apply_filters() Events

  9. do_action( ‘hook’ ); add_action( ‘hook’, ‘my_function’ ); Events: Hooks

  10. add_action( ‘init’, ‘init_function’ ); function init_function() { ... } Events:

    Hooks
  11. add_action( ‘hook’, ‘my_function’, 10 ); Lower number == higher priority

    Events: Priorities
  12. add_action( ‘hook’, ‘my_function’, 10, 2 ); function my_function ( $foo,

    $bar ) { ... } Events: Parameters
  13. apply_filters( ‘filter’, $foo ); add_filter( ‘filter’, ‘my_function’ ); Filters must

    always return a value Events: Filters
  14. add_filter( ‘body_class’, ‘my_function’ ); function my_function( $classes ) { $classes[]

    = ‘my-class’; return $classes; } Events: Filters
  15. remove_action( ‘hook’, ‘function’ ); remove_filter( ‘filter’, ‘function’ ); Priorities must

    match original hook/filter Removing Hooks & Filters
  16. <?php /* * Plugin Name: Google Redirect * Version: 1.0

    */ add_action( ‘init’, ‘google_redirect’ ); function google_redirect () { if( isset( $_GET[‘google_redirect’] ) ) { wp_redirect( ‘http://www.google.com’, 302 ); exit; } } ?> Bringing it Together
  17. Plugin Developer Info: wordpress.org/plugins/about/ Coding Standards: codex.wordpress.org/WordPress_Coding_Standards Action Reference: codex.wordpress.org/Plugin_API/Action_Reference

    Plugin Template: github.com/hlashbrooke/WordPress-Plugin-Template Helpful Links
  18. wpcapetown.co.za woothemes.com hughlashbrooke.com @hlashbrooke