Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amnestywebsite/cmb2-message-field


https://github.com/amnestywebsite/cmb2-message-field

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# CMB2 Message Field
This plugin adds support for an informative message field to CMB2.

## Usage
See the [CMB2](https://github.com/CMB2/CMB2/wiki) Wiki for information on how to use CMB2.

This field supports HTML markup. By default, all output will be escaped using [`wp_kses`](https://developer.wordpress.org/reference/functions/wp_kses/) with the `'post'` context.
You can specify a different context by passing a value to the `'kses'` key.

The message data will be wrapped in a `

` tag. You can declare attributes for this wrapper by passing an associative array of key=>value pairs in the `'attributes'` key.

```php
$metabox->add_field(
[
'id' => 'my-message',
'type' => 'message',
'message' => sprintf( '

%s

', __( 'My Message', 'textdomain' ) ),
'kses' => 'post',
'attributes' => [
'class' => 'my-message-field',
],
]
);
```