piotrpress / dynamic-format
This WordPress plugin adds a dynamic format which renders an output of a selected php callback function added via a filter hook.
Installs: 107
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Type:wordpress-plugin
pkg:composer/piotrpress/dynamic-format
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2025-10-06 16:03:55 UTC
README
This WordPress plugin adds a dynamic format which renders an output of a selected php callback function added via a filter hook.
Usage
Add callback functions via piotrpress/dynamic_format/callbacks filter:
add_filter( 'piotrpress/dynamic_format/callbacks', function( array $callbacks ) : array { $callbacks[ 'Current date' ] = fn( string $content ) : string => date( 'Y-m-d H:i:s' ); return $callbacks; } );
or if you would like to translate the label:
add_filter( 'piotrpress/dynamic_format/callbacks', function( array $callbacks ) : array { $callbacks[ 'current_date' ] = [ 'label' => __( 'Current date', 'textdomain' ), 'value' => fn( string $content ) : string => date( 'Y-m-d H:i:s' ); ]; return $callbacks; } );
Requirements
PHP >= 7.4 version.
