Skip to content

ThemePlate/Hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ThemePlate Hook

Usage

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>

About

Advanced wrapper for filters

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages