1. Go to this page and download the library: Download offsetwp/hook-wordpress 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/ */
offsetwp / hook-wordpress example snippets
use OffsetWP\Hook\WordPress\Filter\WPAdminFooterTextFilter;
new class extends WPAdminFooterTextFilter {
protected function handle( $text ) {
return 'Made with love by OffsetWP | ' . $text;
}
};
use OffsetWP\Hook\WordPress\Filter\WPGetMetaTypeMetadataFilter;
new class extends WPGetMetaTypeMetadataFilter {
public string $hook_name = 'get_post_metadata'; // 'get_{$meta_type}_metadata'
protected function handle( $value, $object_id, $meta_key, $single, $meta_type ) {
return $value;
}
};
use OffsetWP\Hook\WordPress\Filter\WPAdminFooterTextFilter;
new class extends WPAdminFooterTextFilter {
public function __construct( private $myServiceName = 'CustomService' ) {
return parent::__construct();
}
protected function handle( $text ) {
return $this->myServiceName . ' | ' . $text;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.