SlideShare a Scribd company logo
1 of 83
Download to read offline
WordPress Hooks
   Actions and Filters
    WordCamp San Diego 2012
Jeffrey Zinn
ocean goer, wordpress fanboy,
avid backpacker, euro gamer,
soccer hooligan,
voracious coffee drinker

ā€¢ co-founder of pixel jar
ā€¢ wordcamp oc co-organizer
ā€¢ adsanity co-developer
ā€¢ @jeffreyzinn
ā€¢ jeff@jzinn.us
What are Hooks?
ā€¢   Actions - Actions are the hooks that the WordPress core
    launches at speciļ¬c points during execution, or when speciļ¬c
    events occur.Your plugin can specify that one or more of its
    PHP functions are executed at these points, using the Action
    API.

ā€¢   Filters - Filters are the hooks that WordPress launches to
    modify text of various types before adding it to the database
    or sending it to the browser screen.Your plugin can specify
    that one or more of its PHP functions is executed to modify
    speciļ¬c types of text at these times, using the Filter API.
Wait...What are Hooks?


ā€¢Actions - Do Stuff
ā€¢ Filters - Change Stuff
Why Hooks?

ā€¢ Crack into code without editing core ļ¬les
ā€¢ Let others alter your work
Hypothetical
Letā€™s say we were desperate for a widget to place in
our sidebar that displays the word ā€œawesome.ā€
Basic Awesome Widget

activate
Basic Awesome Widget
               sidebar


activate
Basic Awesome Widget
                  sidebar


activate




           test
Hypothetical
Upon further consideration you realize this widget is
sorely lacking in puppy pictures. Now what? Letā€™s
look in the code...
Basic Widget Code
public function widget( $args, $instance ) {

	

   	

   extract( $args );
	

   	

   $title = $instance['title'];

	

   	

   echo $before_widget;
	

   	

   if ( ! empty( $title ) )
	

   	

   	

 echo $before_title . $title . $after_title;
	

   	

	

   	

   echo '<h2>awesome</h2>';
	

   	

            echo $after_widget;
}
Basic Widget Code
public function widget( $args, $instance ) {

	

   	

   extract( $args );
	

   	

   $title = $instance['title'];

	

   	

   echo $before_widget;
	

   	

   if ( ! empty( $title ) )
	

   	

   	

 echo $before_title . $title . $after_title;
	

   	

	

   	

   echo '<h2>awesome</h2>';
	

   	

            echo $after_widget;
}
Deluxe Awesome Widget

       t
wi dge
              sam
                  e
Deluxe Widget Code
public function widget( $args, $instance ) {
	

 extract( $args );
	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

	

   echo $before_widget;
	

   if ( ! empty( $title ) )
	

   	

 echo $before_title . $title . $after_title;
	

   	

	

   do_action( 'before_awesome_widget' );
	

   	

	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
	

   	

	

   do_action( 'after_awesome_widget' );
	

   	

	

   echo $after_widget;
}
Deluxe Widget Code
public function widget( $args, $instance ) {
	

 extract( $args );
	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

	

   echo $before_widget;
	

   if ( ! empty( $title ) )
	

   	

 echo $before_title . $title . $after_title;
	

   	

	

   do_action( 'before_awesome_widget' );
	

   	

	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
	

   	

	

   do_action( 'after_awesome_widget' );
	

   	

	

   echo $after_widget;
}
Deluxe Widget Code
      public function widget( $args, $instance ) {
      	

 extract( $args );
ļ¬lter!	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

     	

   echo $before_widget;
     	

   if ( ! empty( $title ) )
     	

   	

 echo $before_title . $title . $after_title;
     	

   	

     	

   do_action( 'before_awesome_widget' );
     	

   	

     	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
     	

   	

     	

   do_action( 'after_awesome_widget' );
     	

   	

     	

   echo $after_widget;
     }
Deluxe Widget Code
      public function widget( $args, $instance ) {
      	

 extract( $args );
ļ¬lter!	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

      	

   echo $before_widget;
      	

   if ( ! empty( $title ) )
      	

   	

 echo $before_title . $title . $after_title;
      	

   	

      	

action!     do_action( 'before_awesome_widget' );
      	

   	

      	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
      	

   	

      	

   do_action( 'after_awesome_widget' );
      	

   	

      	

   echo $after_widget;
      }
Deluxe Widget Code
      public function widget( $args, $instance ) {
      	

 extract( $args );
ļ¬lter!	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

       	

   echo $before_widget;
       	

   if ( ! empty( $title ) )
       	

   	

 echo $before_title . $title . $after_title;
       	

   	

action!	

   do_action( 'before_awesome_widget' );
       	

   	

 ļ¬lter!	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
       	

   	

       	

   do_action( 'after_awesome_widget' );
       	

   	

       	

   echo $after_widget;
       }
Deluxe Widget Code
      public function widget( $args, $instance ) {
      	

 extract( $args );
ļ¬lter!	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

       	

   echo $before_widget;
       	

   if ( ! empty( $title ) )
       	

   	

 echo $before_title . $title . $after_title;
       	

   	

action!	

   do_action( 'before_awesome_widget' );
       	

   	

 ļ¬lter!	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
       	

   	

action!	

   do_action( 'after_awesome_widget' );
       	

   	

       	

   echo $after_widget;
       }
Actions
                   (do stuff)
ā€¢   do_action() - Creates a hook for attaching actions via
    add_action()

ā€¢   add_action() - Hooks a function onto a speciļ¬c action
    created with do_action()

ā€¢   remove_action() - Removes a function attached to a
    speciļ¬ed action hook
Actions: do_action()
                do_action(Ā $tag,Ā $arg, $extra_argĀ );



ā€¢   $tag - (string) (required) The name of the hook you wish to create.
    Default: None

ā€¢   $arg - (mixed) (optional) The list of arguments this hook accepts.
    Default: ''



                    ...their code...
Actions: add_action()
add_action(Ā $tag,Ā $function_to_add,Ā $priority,Ā $accepted_argsĀ );


ā€¢   $tag - (string) (required) The name of the action you wish to hook onto. Default:
    None

ā€¢   $function_to_add - (callback) (required) The name of the function you wish to be
    called. Default: None

ā€¢   $priority - (int) (optional) How important your function is. Alter this to make your
    function be called before or after other functions. Default: 10

ā€¢   $accepted_args - (int) (optional) How many arguments your function takes. Default: 1



                          ...our code...
Deluxe Widget Code
public function widget( $args, $instance ) {
	

 extract( $args );
	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

	

   echo $before_widget;
	

   if ( ! empty( $title ) )
	

   	

 echo $before_title . $title . $after_title;
	

   	

	

   do_action( 'before_awesome_widget' );
	

   	

	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
	

   	

	

   do_action( 'after_awesome_widget' );
	

   	

	

   echo $after_widget;
}
Deluxe Widget Code
public function widget( $args, $instance ) {
	

 extract( $args );
	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

	

   echo $before_widget;
	

   if ( ! empty( $title ) )
	

   	

 echo $before_title . $title . $after_title;
	

   	

	

   do_action( 'before_awesome_widget' );
	

   	

	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
	

   	

	

   do_action( 'after_awesome_widget' );
	

   	

	

   echo $after_widget;
}
Deluxe Widget Code
       public function widget( $args, $instance ) {
       	

 extract( $args );
       	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

      	

   echo $before_widget;
      	

   if ( ! empty( $title ) )
      	

   	

 echo $before_title . $title . $after_title;
      	

   	

      	

action!     do_action( 'before_awesome_widget' );
      	

   	

      	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
      	

   	

      	

   do_action( 'after_awesome_widget' );
      	

   	

      	

   echo $after_widget;
      }
do_action( 'before_awesome_widget' );


which action?             which function of ours?

add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ );

function puppy() {
   $src = 'http://placedog.com/g/188/150';
   echo '<img src="' . $src . '" />';
}




            ...in your functions.php script....
do_action( 'before_awesome_widget' );


which action?             which function of ours?

add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ );

function puppy() {
   $src = 'http://placedog.com/g/188/150';
   echo '<img src="' . $src . '" />';
}




            ...in your functions.php script....
do_action( 'before_awesome_widget' );


which action?             which function of ours?

add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ );

function puppy() {
   $src = 'http://placedog.com/g/188/150';
   echo '<img src="' . $src . '" />';
}
                                       Use a unique function name




            ...in your functions.php script....
Multiple Calls to Action
add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ );
function puppy() {
   $src = 'http://placedog.com/g/188/150';
   echo '<img src="' . $src . '" />';
}

add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™ );
function warning() {
   echo '<p>Warning: puppies!</p>';
}

        ...in your functions.php script....
Multiple Calls to Action
add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ );
function puppy() {
   $src = 'http://placedog.com/g/188/150';


                      Same
   echo '<img src="' . $src . '" />';


                       Action
}

add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™ );
function warning() {
   echo '<p>Warning: puppies!</p>';
}

        ...in your functions.php script....
Multiple Calls to Action
add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ );
function puppy() {
   $src = 'http://placedog.com/g/188/150';




                                         Diff. F
                      Same
   echo '<img src="' . $src . '" />';




                                           unctio
                       Action
}




                                                 ns
add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™ );
function warning() {
   echo '<p>Warning: puppies!</p>';
}

        ...in your functions.php script....
Multiple Calls to Action
Multiple Calls to Action
Action: before_awesome_widget
Function: puppy
Multiple Calls to Action
Action: before_awesome_widget
Function: puppy


Action: before_awesome_widget
Function: warning
Ordering Actions
add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™, 2 );
function puppy() {
   $src = 'http://placedog.com/g/188/150';
   echo '<img src="' . $src . '" />';
                                           $priority (default 10)
}

add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™, 1 );
function warning() {
   echo '<p>Warning: puppies!</p>';
}

             ...in your functions.php script....
Ordering Actions
Ordering Actions
Action: before_awesome_widget
Function: warning
Priority: 1
Ordering Actions
Action: before_awesome_widget
Function: warning
Priority: 1

Action: before_awesome_widget
Function: puppy
Priority: 2
Actions: remove_action()
remove_action(Ā $tag,Ā $function_to_remove,Ā $priority,Ā $accepted_argsĀ );

      remove_action( 'before_awesome_widget', 'warning', 1 );
Actions: remove_action()
remove_action(Ā $tag,Ā $function_to_remove,Ā $priority,Ā $accepted_argsĀ );

      remove_action( 'before_awesome_widget', 'warning', 1 );




                                                      Be as speciļ¬c as
                                                     the original action
Deluxe Widget Code
public function widget( $args, $instance ) {
	

 extract( $args );
	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

	

   echo $before_widget;
	

   if ( ! empty( $title ) )
	

   	

 echo $before_title . $title . $after_title;
	

   	

	

   do_action( 'before_awesome_widget' );
	

   	

	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
	

   	

	

   do_action( 'after_awesome_widget' );
	

   	

	

   echo $after_widget;
}
Deluxe Widget Code
       public function widget( $args, $instance ) {
       	

 extract( $args );
       	

 $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

      	

   echo $before_widget;
      	

   if ( ! empty( $title ) )
      	

   	

 echo $before_title . $title . $after_title;
      	

   	

      	

   do_action( 'before_awesome_widget' );
      	

   	

ļ¬lter!	

   echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );
      	

   	

      	

   do_action( 'after_awesome_widget' );
      	

   	

      	

   echo $after_widget;
      }
Filters
                (change text)
ā€¢   apply_ļ¬lters() - Calls the functions added to a ļ¬lter
    hook via
    add_ļ¬lter()

ā€¢   add_ļ¬lter() - Hooks a function onto a speciļ¬c ļ¬lter
    action created with add_ļ¬lters()

ā€¢   remove_ļ¬lter() - Removes a function attached to a
    speciļ¬ed ļ¬lter action hook
Filters: apply_ļ¬lters()
             apply_ļ¬lters(Ā $tag,Ā $value,Ā $varĀ ...Ā );


ā€¢   $tag - (string) (required) The name of the ļ¬lter hook.
    Default: None

ā€¢   $value - (mixed) (required) The value which the ļ¬lters
    hooked to $tag may modify.
    Default: None

ā€¢   $var - (mixed) (optional) One or more additional
    variables passed to the ļ¬lter functions.
    Default: None
Filters: add_ļ¬lter()
add_ļ¬lter(Ā $tag,Ā $function_to_add,Ā $priority,Ā $accepted_argsĀ );


 ā€¢   $tag - (string) (required) The name of the ļ¬lter to hook the $function_to_add
     to. Default: None

 ā€¢   $function_to_add - (callback) (required) The name of the function to be called
     when the ļ¬lter is applied. Default: None

 ā€¢   $priority - (int) (optional) Used to specify the order in which the functions
     associated with a particular action are executed. Functions with the same
     priority are executed in the order in which they were added to the action.
     Default: 10

 ā€¢   $accepted_args - (int) (optional) Number of arguments the function(s) accept
     (s). Default: 1
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


    which ļ¬lter?            which function of ours?

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );

function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;

      return $text;
}



              ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );




add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );

function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;

    return $text;
}                                         Use a unique function name




             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );




add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );

function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;

    return $text;
}



             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );




add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );

function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;

    return $text;
}
                    always return!




             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );




add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );

function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;

    return $text;
}
                    always return!




             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' );


add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 );
function ļ¬lter_awesome( $text ) {
   $text .= ā€˜<h4>puppies</h4>ā€™;
   return $text;
}

add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 );
function second_ļ¬lter( $text ) {
   $text = ā€˜<h2>dogs!</h2>ā€™;
   return $text;
}

             ...in your functions.php script....
remove_ļ¬lter()
remove_ļ¬lter(Ā $tag,Ā $function_to_remove,Ā $priority,Ā $accepted_argsĀ );




         remove_ļ¬lter( 'the_content', 'wpautop' );
Ridiculous Filter
public function widget( $args, $instance ) {
	

  extract( $args );
	

  $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

	

   echo $before_widget;
	

   if ( ! empty( $title ) )
	

   	

    echo $before_title . $title . $after_title;
	

   	

	

   do_action( 'before_ridiculous_widget' );
	

	

   $wrap = ( is_home() ) ? 'h2' : 'h3';
	

   $text = 'awesome';
	

   $pattern = '<%s class="awesome">%s</%s>';
	

   $awesome = sprintf( $pattern, $wrap, $text, $wrap );
	

	

   echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );
	

	

   do_action( 'after_ridiculous_widget' );
	

	

   echo $after_widget;
}
Ridiculous Filter
        public function widget( $args, $instance ) {
        	

  extract( $args );
        	

  $title = apply_ļ¬lters( 'widget_title', $instance['title'] );

       	

   echo $before_widget;
       	

   if ( ! empty( $title ) )
       	

   	

    echo $before_title . $title . $after_title;
       	

   	

       	

   do_action( 'before_ridiculous_widget' );
       	

       	

   $wrap = ( is_home() ) ? 'h2' : 'h3';
       	

   $text = 'awesome';
       	

   $pattern = '<%s class="awesome">%s</%s>';
       	

   $awesome = sprintf( $pattern, $wrap, $text, $wrap );
       	

ļ¬lter! 	

   echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );
       	

       	

   do_action( 'after_ridiculous_widget' );
       	

       	

   echo $after_widget;
       }
Ridiculous Filter
$wrap = ( is_home() ) ? 'h2' : 'h3';
$text = 'awesome';
$pattern = '<%s>%s</%s>';
$awesome = sprintf( $pattern, $wrap, $text, $wrap );
	

echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );
Ridiculous Filter
$wrap = ( is_home() ) ? 'h2' : 'h3';
$text = 'awesome';
$pattern = '<%s>%s</%s>';
$awesome = sprintf( $pattern, $wrap, $text, $wrap );
	

echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );



             is_home()                      !is_home()

        <h2>awesome</h2>               <h3>awesome</h3>
Ridiculous Filter
$wrap = ( is_home() ) ? 'h2' : 'h3';
$text = 'awesome';
$pattern = '<%s>%s</%s>';




                                                           ??????
$awesome = sprintf( $pattern, $wrap, $text, $wrap );
	

echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );



             is_home()                      !is_home()

        <h2>awesome</h2>               <h3>awesome</h3>
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...

 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...

 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...

 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...         <h2>awesome</h2>



 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...         <h2>awesome</h2>     h2



 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...         <h2>awesome</h2>     h2      awesome



 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...

 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );


...assume is_home()...

 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 );

 function ridiculous_ļ¬lter( $text, $var1, $var2 ) {
 	

 $var2 = "not awesome";
 	

 $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 );
 	

 	

 return $new;
 }

               ...in your functions.php script....
Examples
Genesis Framework
Genesis Actions
Genesis Filters
Other Themes and Plugins?
ā€¢   WordPress: 790+ actions, 1250+ ļ¬lters

ā€¢   Genesis Framework: 180+ actions; 100+ ļ¬lters

ā€¢   Gravity Forms: 120+ actions; 270+ ļ¬lters

ā€¢   Shopp: 130+ actions; 230+ ļ¬lters
Where Hooks?
ā€¢   Plugin/Theme Wiki

ā€¢   Documentation

ā€¢   Actual Code
           (search for do_action and apply_ļ¬lters)

ā€¢   Google search!
ā€¢   http://codex.wordpress.org/Plugin_API
Yes, Hooks!

ā€¢Actions - Do Stuff
ā€¢ Filters - Change Stuff
do_action( ā€˜the_endā€™ )
    add_action( ā€˜the_endā€™, ā€˜questionsā€™ );
    function questions() {
       echo ā€˜Are there any questions?ā€™;
    }

slides: http://slideshare.net/jeffreyzinn/hooks-wcsd12
       code: https://gist.github.com/2163780

More Related Content

What's hot

Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLIDVic Metcalfe
Ā 
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICDecoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICKonstantin Kudryashov
Ā 
Design how your objects talk through mocking
Design how your objects talk through mockingDesign how your objects talk through mocking
Design how your objects talk through mockingKonstantin Kudryashov
Ā 
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)Javier Eguiluz
Ā 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDAleix VergƩs
Ā 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
Ā 
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Konstantin Kudryashov
Ā 
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?Yevhen Kotelnytskyi
Ā 
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0Yevhen Kotelnytskyi
Ā 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
Ā 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
Ā 
Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design PatternsRobert Casanova
Ā 
Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019BalƔzs TatƔr
Ā 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0Phil Sturgeon
Ā 
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019BalƔzs TatƔr
Ā 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the newRemy Sharp
Ā 

What's hot (20)

Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
Ā 
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DICDecoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DIC
Ā 
Design how your objects talk through mocking
Design how your objects talk through mockingDesign how your objects talk through mocking
Design how your objects talk through mocking
Ā 
Nubilus Perl
Nubilus PerlNubilus Perl
Nubilus Perl
Ā 
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
Ā 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
Ā 
Perl Web Client
Perl Web ClientPerl Web Client
Perl Web Client
Ā 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
Ā 
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
Ā 
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress?
Ā 
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0
ŠšŠ°Šŗ ŠæŠ¾Š»ŃƒŃ‡Šøть чёрŠ½Ń‹Š¹ ŠæŠ¾ŃŃ ŠæŠ¾ WordPress? v2.0
Ā 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
Ā 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016
Ā 
Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design Patterns
Ā 
Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
Ā 
Mojolicious
MojoliciousMojolicious
Mojolicious
Ā 
Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019
Ā 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
Ā 
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Ā 
jQuery: out with the old, in with the new
jQuery: out with the old, in with the newjQuery: out with the old, in with the new
jQuery: out with the old, in with the new
Ā 

Viewers also liked

7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMS
7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMS7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMS
7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMSAlexander Andreev
Ā 
IMPM_ē¶²č·Æē•™å­øBlog
IMPM_ē¶²č·Æē•™å­øBlogIMPM_ē¶²č·Æē•™å­øBlog
IMPM_ē¶²č·Æē•™å­øBlogKuan Ming Feng
Ā 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluationBillysmedia
Ā 
國防報告1 38 39
國防報告1 38 39國防報告1 38 39
國防報告1 38 39TFGYi12
Ā 
F0306601 Davaakhuu Erdenekhuu
F0306601 Davaakhuu Erdenekhuu F0306601 Davaakhuu Erdenekhuu
F0306601 Davaakhuu Erdenekhuu Sasha Da
Ā 
Product Gallery 1 2012
Product Gallery 1 2012Product Gallery 1 2012
Product Gallery 1 2012rramirezdynacast
Ā 
Welcome to Bellingham Washington / Bellingham WA
Welcome to Bellingham Washington / Bellingham WAWelcome to Bellingham Washington / Bellingham WA
Welcome to Bellingham Washington / Bellingham WARich Johnson
Ā 
Kamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya Japan
Kamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya JapanKamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya Japan
Kamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya JapanRich Johnson
Ā 
Who is anyssa
Who is anyssaWho is anyssa
Who is anyssaAnyssa Jane
Ā 
Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...
Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...
Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...Giuseppe Fattori
Ā 
Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24
Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24
Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24ŠœŠšŠžŠ£ Š”ŠžŠØ ā„– 1 Š³. Š”ŠøŠ¼
Ā 
A Best Practice of Enterprise 2.0: the Photoviva Case Study
A Best Practice of Enterprise 2.0: the Photoviva Case StudyA Best Practice of Enterprise 2.0: the Photoviva Case Study
A Best Practice of Enterprise 2.0: the Photoviva Case StudyWalter Del Prete
Ā 
Collaborationtools aalto 2-10-2012_slideshare
Collaborationtools aalto 2-10-2012_slideshareCollaborationtools aalto 2-10-2012_slideshare
Collaborationtools aalto 2-10-2012_slideshareTero Peltola
Ā 
ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"
ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"
ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"Yarynka Voznyak
Ā 

Viewers also liked (20)

7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMS
7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMS7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMS
7 Š·Š¾Š»Š¾Ń‚Ń‹Ń… ŠæрŠ°Š²ŠøŠ» Š²Š½ŠµŠ“рŠµŠ½Šøя LMS
Ā 
IMPM_ē¶²č·Æē•™å­øBlog
IMPM_ē¶²č·Æē•™å­øBlogIMPM_ē¶²č·Æē•™å­øBlog
IMPM_ē¶²č·Æē•™å­øBlog
Ā 
Pertemuan 6
Pertemuan 6Pertemuan 6
Pertemuan 6
Ā 
Pertemuan 11
Pertemuan 11Pertemuan 11
Pertemuan 11
Ā 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluation
Ā 
國防報告1 38 39
國防報告1 38 39國防報告1 38 39
國防報告1 38 39
Ā 
F0306601 Davaakhuu Erdenekhuu
F0306601 Davaakhuu Erdenekhuu F0306601 Davaakhuu Erdenekhuu
F0306601 Davaakhuu Erdenekhuu
Ā 
Product Gallery 1 2012
Product Gallery 1 2012Product Gallery 1 2012
Product Gallery 1 2012
Ā 
Welcome to Bellingham Washington / Bellingham WA
Welcome to Bellingham Washington / Bellingham WAWelcome to Bellingham Washington / Bellingham WA
Welcome to Bellingham Washington / Bellingham WA
Ā 
Kamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya Japan
Kamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya JapanKamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya Japan
Kamiseya Japan / Kamiseya Naval Security Base Japan / Company E Kamiseya Japan
Ā 
Who is anyssa
Who is anyssaWho is anyssa
Who is anyssa
Ā 
Kbsrbunga telur
Kbsrbunga telurKbsrbunga telur
Kbsrbunga telur
Ā 
Pertemuan 1tiga
Pertemuan 1tigaPertemuan 1tiga
Pertemuan 1tiga
Ā 
Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...
Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...
Le strategie di prevenzione e lo stile di comunicazione. Quando contenuto e f...
Ā 
Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24
Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24
Š—Š°ŠŗрŠµŠæŠ»ŠµŠ½ŠøŠµ ŠæрŠ¾Š¹Š“ŠµŠ½Š½Š¾Š³Š¾ ŠŸŃ€Š¾ŠæŠøсь с. 24
Ā 
A Best Practice of Enterprise 2.0: the Photoviva Case Study
A Best Practice of Enterprise 2.0: the Photoviva Case StudyA Best Practice of Enterprise 2.0: the Photoviva Case Study
A Best Practice of Enterprise 2.0: the Photoviva Case Study
Ā 
Collaborationtools aalto 2-10-2012_slideshare
Collaborationtools aalto 2-10-2012_slideshareCollaborationtools aalto 2-10-2012_slideshare
Collaborationtools aalto 2-10-2012_slideshare
Ā 
ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"
ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"
ŠŸŃ€Š¾Š“уŠŗтŠø Š“Š»Ń ŠæŠ¾Ń‚Ń€ŠµŠ± Š±Ń–Š·Š½ŠµŃŃƒ тŠ° ŠæŠ¾Š»Ń–Ń‚ŠøчŠ½Š¾Ń— Š“іяŠ»ŃŒŠ½Š¾ŃŃ‚Ń–_Š”Š¾Ń†Ń–Š¾Š»Š¾Š³Ń–чŠ½Š° Š°Š³ŠµŠ½Ń†Ń–я "Š¤Š°Š¼Š°"
Ā 
ŠØŠ»ŃŃ… Š°Š“ ŠæŠ°Ń‡Š°Ń‚Šŗу стŠ°Š³Š¾Š“Š“Š·Ń: Š“Š° 115-Š³Š¾Š“Š“Š·Ń Š· Š“Š½Ń Š½Š°Ń€Š°Š“Š¶ŃŠ½Š½Ń ŠœŃ–Ń…Š°Ń–Š»Š° Š“Š°Š½Ń‡Š°Ń€Ń‹ŠŗŠ°
ŠØŠ»ŃŃ… Š°Š“ ŠæŠ°Ń‡Š°Ń‚Šŗу стŠ°Š³Š¾Š“Š“Š·Ń: Š“Š° 115-Š³Š¾Š“Š“Š·Ń Š· Š“Š½Ń Š½Š°Ń€Š°Š“Š¶ŃŠ½Š½Ń ŠœŃ–Ń…Š°Ń–Š»Š° Š“Š°Š½Ń‡Š°Ń€Ń‹ŠŗŠ°ŠØŠ»ŃŃ… Š°Š“ ŠæŠ°Ń‡Š°Ń‚Šŗу стŠ°Š³Š¾Š“Š“Š·Ń: Š“Š° 115-Š³Š¾Š“Š“Š·Ń Š· Š“Š½Ń Š½Š°Ń€Š°Š“Š¶ŃŠ½Š½Ń ŠœŃ–Ń…Š°Ń–Š»Š° Š“Š°Š½Ń‡Š°Ń€Ń‹ŠŗŠ°
ŠØŠ»ŃŃ… Š°Š“ ŠæŠ°Ń‡Š°Ń‚Šŗу стŠ°Š³Š¾Š“Š“Š·Ń: Š“Š° 115-Š³Š¾Š“Š“Š·Ń Š· Š“Š½Ń Š½Š°Ń€Š°Š“Š¶ŃŠ½Š½Ń ŠœŃ–Ń…Š°Ń–Š»Š° Š“Š°Š½Ń‡Š°Ń€Ń‹ŠŗŠ°
Ā 
Resistive Switching
Resistive SwitchingResistive Switching
Resistive Switching
Ā 

Similar to Hooks WCSD12

Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery PluginsJƶrn Zaefferer
Ā 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secretsBastian Feder
Ā 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretssmueller_sandsmedia
Ā 
Using Actions and Filters in WordPress to Make a Plugin Your Own
Using Actions and Filters in WordPress to Make a Plugin Your OwnUsing Actions and Filters in WordPress to Make a Plugin Your Own
Using Actions and Filters in WordPress to Make a Plugin Your OwnBrian Hogg
Ā 
Separation of concerns - DPC12
Separation of concerns - DPC12Separation of concerns - DPC12
Separation of concerns - DPC12Stephan Hochdƶrfer
Ā 
WordPress Realtime - WordCamp SĆ£o Paulo 2015
WordPress Realtime - WordCamp SĆ£o Paulo 2015WordPress Realtime - WordCamp SĆ£o Paulo 2015
WordPress Realtime - WordCamp SĆ£o Paulo 2015Fernando Daciuk
Ā 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptGuy Royse
Ā 
Unittests fĆ¼r Dummies
Unittests fĆ¼r DummiesUnittests fĆ¼r Dummies
Unittests fĆ¼r DummiesLars Jankowfsky
Ā 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secretsBastian Feder
Ā 
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you need
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you needDutch PHP Conference - PHPSpec 2 - The only Design Tool you need
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you needKacper Gunia
Ā 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologyDaniel Knell
Ā 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPresswpnepal
Ā 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11Michelangelo van Dam
Ā 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxMichelangelo van Dam
Ā 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Knowgirish82
Ā 
Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just RubyMarco Otte-Witte
Ā 
Clean Javascript
Clean JavascriptClean Javascript
Clean JavascriptRyunosuke SATO
Ā 
jQuery - IntroduĆ§Ć£o
jQuery - IntroduĆ§Ć£ojQuery - IntroduĆ§Ć£o
jQuery - IntroduĆ§Ć£oGustavo Dutra
Ā 
JQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraJQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraTchelinux
Ā 

Similar to Hooks WCSD12 (20)

Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery Plugins
Ā 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
Ā 
international PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secretsinternational PHP2011_Bastian Feder_jQuery's Secrets
international PHP2011_Bastian Feder_jQuery's Secrets
Ā 
Using Actions and Filters in WordPress to Make a Plugin Your Own
Using Actions and Filters in WordPress to Make a Plugin Your OwnUsing Actions and Filters in WordPress to Make a Plugin Your Own
Using Actions and Filters in WordPress to Make a Plugin Your Own
Ā 
Separation of concerns - DPC12
Separation of concerns - DPC12Separation of concerns - DPC12
Separation of concerns - DPC12
Ā 
WordPress Realtime - WordCamp SĆ£o Paulo 2015
WordPress Realtime - WordCamp SĆ£o Paulo 2015WordPress Realtime - WordCamp SĆ£o Paulo 2015
WordPress Realtime - WordCamp SĆ£o Paulo 2015
Ā 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
Ā 
Unittests fĆ¼r Dummies
Unittests fĆ¼r DummiesUnittests fĆ¼r Dummies
Unittests fĆ¼r Dummies
Ā 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
Ā 
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you need
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you needDutch PHP Conference - PHPSpec 2 - The only Design Tool you need
Dutch PHP Conference - PHPSpec 2 - The only Design Tool you need
Ā 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
Ā 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
Ā 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11
Ā 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
Ā 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Know
Ā 
Rails is not just Ruby
Rails is not just RubyRails is not just Ruby
Rails is not just Ruby
Ā 
Clean Javascript
Clean JavascriptClean Javascript
Clean Javascript
Ā 
jQuery - IntroduĆ§Ć£o
jQuery - IntroduĆ§Ć£ojQuery - IntroduĆ§Ć£o
jQuery - IntroduĆ§Ć£o
Ā 
JQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo DutraJQuery do dia-a-dia Gustavo Dutra
JQuery do dia-a-dia Gustavo Dutra
Ā 
J queryui
J queryuiJ queryui
J queryui
Ā 

Recently uploaded

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
Ā 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vƔzquez
Ā 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
Ā 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
Ā 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
Ā 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
Ā 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
Ā 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
Ā 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
Ā 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
Ā 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
Ā 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
Ā 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
Ā 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Ā 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Ā 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Ā 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
Ā 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Ā 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Ā 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Ā 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Ā 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Ā 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Ā 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Ā 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Ā 

Hooks WCSD12

  • 1. WordPress Hooks Actions and Filters WordCamp San Diego 2012
  • 2. Jeffrey Zinn ocean goer, wordpress fanboy, avid backpacker, euro gamer, soccer hooligan, voracious coffee drinker ā€¢ co-founder of pixel jar ā€¢ wordcamp oc co-organizer ā€¢ adsanity co-developer ā€¢ @jeffreyzinn ā€¢ jeff@jzinn.us
  • 3. What are Hooks? ā€¢ Actions - Actions are the hooks that the WordPress core launches at speciļ¬c points during execution, or when speciļ¬c events occur.Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API. ā€¢ Filters - Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen.Your plugin can specify that one or more of its PHP functions is executed to modify speciļ¬c types of text at these times, using the Filter API.
  • 4. Wait...What are Hooks? ā€¢Actions - Do Stuff ā€¢ Filters - Change Stuff
  • 5. Why Hooks? ā€¢ Crack into code without editing core ļ¬les ā€¢ Let others alter your work
  • 6. Hypothetical Letā€™s say we were desperate for a widget to place in our sidebar that displays the word ā€œawesome.ā€
  • 8. Basic Awesome Widget sidebar activate
  • 9. Basic Awesome Widget sidebar activate test
  • 10. Hypothetical Upon further consideration you realize this widget is sorely lacking in puppy pictures. Now what? Letā€™s look in the code...
  • 11. Basic Widget Code public function widget( $args, $instance ) { extract( $args ); $title = $instance['title']; echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; echo '<h2>awesome</h2>'; echo $after_widget; }
  • 12. Basic Widget Code public function widget( $args, $instance ) { extract( $args ); $title = $instance['title']; echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; echo '<h2>awesome</h2>'; echo $after_widget; }
  • 13. Deluxe Awesome Widget t wi dge sam e
  • 14. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 15. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 16. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); ļ¬lter! $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 17. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); ļ¬lter! $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; action! do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 18. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); ļ¬lter! $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; action! do_action( 'before_awesome_widget' ); ļ¬lter! echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 19. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); ļ¬lter! $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; action! do_action( 'before_awesome_widget' ); ļ¬lter! echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); action! do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 20. Actions (do stuff) ā€¢ do_action() - Creates a hook for attaching actions via add_action() ā€¢ add_action() - Hooks a function onto a speciļ¬c action created with do_action() ā€¢ remove_action() - Removes a function attached to a speciļ¬ed action hook
  • 21. Actions: do_action() do_action(Ā $tag,Ā $arg, $extra_argĀ ); ā€¢ $tag - (string) (required) The name of the hook you wish to create. Default: None ā€¢ $arg - (mixed) (optional) The list of arguments this hook accepts. Default: '' ...their code...
  • 22. Actions: add_action() add_action(Ā $tag,Ā $function_to_add,Ā $priority,Ā $accepted_argsĀ ); ā€¢ $tag - (string) (required) The name of the action you wish to hook onto. Default: None ā€¢ $function_to_add - (callback) (required) The name of the function you wish to be called. Default: None ā€¢ $priority - (int) (optional) How important your function is. Alter this to make your function be called before or after other functions. Default: 10 ā€¢ $accepted_args - (int) (optional) How many arguments your function takes. Default: 1 ...our code...
  • 23. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 24. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 25. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; action! do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 26. do_action( 'before_awesome_widget' ); which action? which function of ours? add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ ); function puppy() { $src = 'http://placedog.com/g/188/150'; echo '<img src="' . $src . '" />'; } ...in your functions.php script....
  • 27. do_action( 'before_awesome_widget' ); which action? which function of ours? add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ ); function puppy() { $src = 'http://placedog.com/g/188/150'; echo '<img src="' . $src . '" />'; } ...in your functions.php script....
  • 28. do_action( 'before_awesome_widget' ); which action? which function of ours? add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ ); function puppy() { $src = 'http://placedog.com/g/188/150'; echo '<img src="' . $src . '" />'; } Use a unique function name ...in your functions.php script....
  • 29.
  • 30. Multiple Calls to Action add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ ); function puppy() { $src = 'http://placedog.com/g/188/150'; echo '<img src="' . $src . '" />'; } add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™ ); function warning() { echo '<p>Warning: puppies!</p>'; } ...in your functions.php script....
  • 31. Multiple Calls to Action add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ ); function puppy() { $src = 'http://placedog.com/g/188/150'; Same echo '<img src="' . $src . '" />'; Action } add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™ ); function warning() { echo '<p>Warning: puppies!</p>'; } ...in your functions.php script....
  • 32. Multiple Calls to Action add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™ ); function puppy() { $src = 'http://placedog.com/g/188/150'; Diff. F Same echo '<img src="' . $src . '" />'; unctio Action } ns add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™ ); function warning() { echo '<p>Warning: puppies!</p>'; } ...in your functions.php script....
  • 34. Multiple Calls to Action Action: before_awesome_widget Function: puppy
  • 35. Multiple Calls to Action Action: before_awesome_widget Function: puppy Action: before_awesome_widget Function: warning
  • 36. Ordering Actions add_action( ā€˜before_awesome_widgetā€™, ā€˜puppyā€™, 2 ); function puppy() { $src = 'http://placedog.com/g/188/150'; echo '<img src="' . $src . '" />'; $priority (default 10) } add_action( ā€˜before_awesome_widgetā€™, ā€˜warningā€™, 1 ); function warning() { echo '<p>Warning: puppies!</p>'; } ...in your functions.php script....
  • 39. Ordering Actions Action: before_awesome_widget Function: warning Priority: 1 Action: before_awesome_widget Function: puppy Priority: 2
  • 41. Actions: remove_action() remove_action(Ā $tag,Ā $function_to_remove,Ā $priority,Ā $accepted_argsĀ ); remove_action( 'before_awesome_widget', 'warning', 1 ); Be as speciļ¬c as the original action
  • 42. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_awesome_widget' ); echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 43. Deluxe Widget Code public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_awesome_widget' ); ļ¬lter! echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); do_action( 'after_awesome_widget' ); echo $after_widget; }
  • 44. Filters (change text) ā€¢ apply_ļ¬lters() - Calls the functions added to a ļ¬lter hook via add_ļ¬lter() ā€¢ add_ļ¬lter() - Hooks a function onto a speciļ¬c ļ¬lter action created with add_ļ¬lters() ā€¢ remove_ļ¬lter() - Removes a function attached to a speciļ¬ed ļ¬lter action hook
  • 45. Filters: apply_ļ¬lters() apply_ļ¬lters(Ā $tag,Ā $value,Ā $varĀ ...Ā ); ā€¢ $tag - (string) (required) The name of the ļ¬lter hook. Default: None ā€¢ $value - (mixed) (required) The value which the ļ¬lters hooked to $tag may modify. Default: None ā€¢ $var - (mixed) (optional) One or more additional variables passed to the ļ¬lter functions. Default: None
  • 46. Filters: add_ļ¬lter() add_ļ¬lter(Ā $tag,Ā $function_to_add,Ā $priority,Ā $accepted_argsĀ ); ā€¢ $tag - (string) (required) The name of the ļ¬lter to hook the $function_to_add to. Default: None ā€¢ $function_to_add - (callback) (required) The name of the function to be called when the ļ¬lter is applied. Default: None ā€¢ $priority - (int) (optional) Used to specify the order in which the functions associated with a particular action are executed. Functions with the same priority are executed in the order in which they were added to the action. Default: 10 ā€¢ $accepted_args - (int) (optional) Number of arguments the function(s) accept (s). Default: 1
  • 47. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); which ļ¬lter? which function of ours? add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } ...in your functions.php script....
  • 48. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } Use a unique function name ...in your functions.php script....
  • 49. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } ...in your functions.php script....
  • 50. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } always return! ...in your functions.php script....
  • 51. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } always return! ...in your functions.php script....
  • 52. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 53. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 54. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 55. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 56. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™ ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™ ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 57. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 58. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 59. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 60. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 61. echo apply_ļ¬lters( 'ļ¬lter_awesome_text', '<h2>awesome</h2>' ); add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜ļ¬lter_awesomeā€™, 2 ); function ļ¬lter_awesome( $text ) { $text .= ā€˜<h4>puppies</h4>ā€™; return $text; } add_ļ¬lter( ā€˜ļ¬lter_awesome_textā€™, ā€˜second_ļ¬lterā€™, 1 ); function second_ļ¬lter( $text ) { $text = ā€˜<h2>dogs!</h2>ā€™; return $text; } ...in your functions.php script....
  • 63. Ridiculous Filter public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_ridiculous_widget' ); $wrap = ( is_home() ) ? 'h2' : 'h3'; $text = 'awesome'; $pattern = '<%s class="awesome">%s</%s>'; $awesome = sprintf( $pattern, $wrap, $text, $wrap ); echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); do_action( 'after_ridiculous_widget' ); echo $after_widget; }
  • 64. Ridiculous Filter public function widget( $args, $instance ) { extract( $args ); $title = apply_ļ¬lters( 'widget_title', $instance['title'] ); echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; do_action( 'before_ridiculous_widget' ); $wrap = ( is_home() ) ? 'h2' : 'h3'; $text = 'awesome'; $pattern = '<%s class="awesome">%s</%s>'; $awesome = sprintf( $pattern, $wrap, $text, $wrap ); ļ¬lter! echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); do_action( 'after_ridiculous_widget' ); echo $after_widget; }
  • 65. Ridiculous Filter $wrap = ( is_home() ) ? 'h2' : 'h3'; $text = 'awesome'; $pattern = '<%s>%s</%s>'; $awesome = sprintf( $pattern, $wrap, $text, $wrap ); echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text );
  • 66. Ridiculous Filter $wrap = ( is_home() ) ? 'h2' : 'h3'; $text = 'awesome'; $pattern = '<%s>%s</%s>'; $awesome = sprintf( $pattern, $wrap, $text, $wrap ); echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); is_home() !is_home() <h2>awesome</h2> <h3>awesome</h3>
  • 67. Ridiculous Filter $wrap = ( is_home() ) ? 'h2' : 'h3'; $text = 'awesome'; $pattern = '<%s>%s</%s>'; ?????? $awesome = sprintf( $pattern, $wrap, $text, $wrap ); echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); is_home() !is_home() <h2>awesome</h2> <h3>awesome</h3>
  • 68. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 69. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 70. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 71. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... <h2>awesome</h2> add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 72. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... <h2>awesome</h2> h2 add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 73. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... <h2>awesome</h2> h2 awesome add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 74. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 75. echo apply_ļ¬lters( 'ļ¬lter_ridiculous_text', $awesome, $wrap, $text ); ...assume is_home()... add_ļ¬lter( 'ļ¬lter_ridiculous_text', 'ridiculous_ļ¬lter', 10, 3 ); function ridiculous_ļ¬lter( $text, $var1, $var2 ) { $var2 = "not awesome"; $new = sprintf( '<%s>%s</%s>', $var1, $var2, $var1 ); return $new; } ...in your functions.php script....
  • 80. Other Themes and Plugins? ā€¢ WordPress: 790+ actions, 1250+ ļ¬lters ā€¢ Genesis Framework: 180+ actions; 100+ ļ¬lters ā€¢ Gravity Forms: 120+ actions; 270+ ļ¬lters ā€¢ Shopp: 130+ actions; 230+ ļ¬lters
  • 81. Where Hooks? ā€¢ Plugin/Theme Wiki ā€¢ Documentation ā€¢ Actual Code (search for do_action and apply_ļ¬lters) ā€¢ Google search! ā€¢ http://codex.wordpress.org/Plugin_API
  • 82. Yes, Hooks! ā€¢Actions - Do Stuff ā€¢ Filters - Change Stuff
  • 83. do_action( ā€˜the_endā€™ ) add_action( ā€˜the_endā€™, ā€˜questionsā€™ ); function questions() { echo ā€˜Are there any questions?ā€™; } slides: http://slideshare.net/jeffreyzinn/hooks-wcsd12 code: https://gist.github.com/2163780