Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amnestywebsite/cmb2-message-field
https://github.com/amnestywebsite/cmb2-message-field
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/amnestywebsite/cmb2-message-field
- Owner: amnestywebsite
- License: other
- Created: 2024-02-13T12:38:44.000Z (9 months ago)
- Default Branch: develop
- Last Pushed: 2024-02-28T14:50:46.000Z (9 months ago)
- Last Synced: 2024-04-29T23:51:52.981Z (7 months ago)
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
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',
],
]
);
```