use ThemePlate\Hook;
// Hook::<ACTION>( <TAG>, <VALUE> )
Hook::append( 'sample_filter', 'ing' );
Hook::prepend( 'sample_filter', 're-' );
Hook::return( 'sample_filter', 'this!' );
Hook::pluck( 'sample_filter', 'i' );
Hook::replace( 'sample_filter', '!', '...' );
Hook::insert( 'sample_filter', 'u', 2 );
Hook::once( 'sample_filter', array( 'pluck', 'th' ) );
^Line by line output with initial value test
ACTION | VALUE | RESULT #1 | RESULT #2 |
---|---|---|---|
append | ing | testing | testing |
prepend | re- | re-testing | re-testing |
return | this! | this! | this! |
pluck | i | ths! | ths! |
replace | ["!","..."] | ths... | ths... |
insert | ["u",2] | thus... | thus... |
once | ["pluck","th"] | us... | thus... |
// apply_filters( <TAG>, <INITIAL> );
apply_filters( 'sample_filter', 'test' ); // <RESULT #1>
apply_filters( 'sample_filter', 'test' ); // <RESULT #2>