PHP code example of themeplate / hook

1. Go to this page and download the library: Download themeplate/hook library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

themeplate / hook example snippets



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' ) );

// apply_filters( <TAG>, <INITIAL> );
apply_filters( 'sample_filter', 'test' ); // <RESULT #1>
apply_filters( 'sample_filter', 'test' ); // <RESULT #2>