Ben Doherty: OOP for Theme Development

3 responses on “Ben Doherty: OOP for Theme Development

  1. Robert O'Rourke

    Often overlooked regarding anonymous functions. You can pass in variables from the outside scope quite easily with ‘use()':

    
    $var = 'some string';
    add_filter( 'some_filter', function( $value ) use( $var ) {
         return $value . $var;
    }, 10, 1 );
    

    Like

  2. bendohmv@gmail.com

    Robert, you are right that anonymous functions are very useful, especially when defining short filter or action handlers that use variables in the current scope (closures.)

    In this talk, I tried to avoid using PHP features that are newer than the minimum version of PHP required by WordPress, which is 5.2.4. Since closures / anonymous functions are a PHP 5.3-ism, I didn’t want to encourage their usage and then have developers mystified at why their code breaks on a host that only supports PHP 5.2.

    Thanks for your input!

    Like

  3. Nicolas

    Hi Ben,

    Your presentation made me change the way I used to code WordPress Theme.
    My theme (Customizr) is built upon the OOP principles you describes.

    Thanks for those awesome slides!
    PS : I credit you in my functions.php file

    Like

Continue the discussion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Published

June 13, 2013

This presentation covers techniques and coding standards for developing concise, high-quality, re-usable theme functionality using Object Oriented Programming methodology. Learn how to employ the WordPress actions and filters API to create communication channels between objects without creating fragile object dependencies. Topics covered include encapsulation, re-usability, singletons and best practices. Naming conventions for symbols and files will be covered and explained.

Presentation Slides »

Rate this:

Event

WordCamp Providence 2012 15

Speakers

Ben Doherty 1

Tags

Theme Development 30

Language

English 2113

Download
MP4: Low, Med, High
OGG: Low
Subtitles
Subtitle this video →
Follow

Get every new post delivered to your Inbox.

Join 11,600 other followers

%d bloggers like this: