piotrpress / dynamic-block
This WordPress plugin adds a dynamic block which renders an output of a selected php callback function added via a filter hook.
Package info
github.com/PiotrPress/wordpress-dynamic-block
Type:wordpress-plugin
pkg:composer/piotrpress/dynamic-block
v0.3.0
2025-10-06 15:59 UTC
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2026-03-06 16:49:32 UTC
README
This WordPress plugin adds a dynamic block which renders an output of a selected php callback function added via a filter hook.
Usage
Add callback functions via piotrpress/dynamic_block/callbacks filter:
add_filter( 'piotrpress/dynamic_block/callbacks', function( array $callbacks ) : array { $callbacks[ 'Current date' ] = fn( array $attributes ) : string => date( 'Y-m-d H:i:s' ); return $callbacks; } );
or if you would like to translate the label:
add_filter( 'piotrpress/dynamic_block/callbacks', function( array $callbacks ) : array { $callbacks[ 'current_date' ] = [ 'label' => __( 'Current date', 'textdomain' ), 'value' => fn( array $attributes ) : string => date( 'Y-m-d H:i:s' ); ]; return $callbacks; } );
Requirements
PHP >= 7.4 version.
