WP Manifestindependent plugin directory
manifest / editor / wordpress-dynamic-format

Dynamic Format

This WordPress plugin adds a dynamic format which renders an output of a selected php callback function added via a filter hook.

★ 0stars
158composer installs

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/piotrpress/wordpress-dynamic-format/archive/refs/heads/master.zip

On Packagist as piotrpress/dynamic-format:

composer require piotrpress/dynamic-format
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

This WordPress plugin adds a dynamic format which renders an output of a selected php callback function added via a filter hook.

Dynamic format in WordPress block editor view

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.

License

GPL v3 or later