๐ฆ Plugin: Custom Field Shortcode
Displays post meta (custom fields) via shortcode. Designed for block themes like Twenty Twenty-Five.
๐ง Shortcode
[custom_field field="your_custom_field_key"]
โ Supported Attributes
| Attribute | Description |
|---|---|
| field | (Required) The custom field (meta key) name. |
| post_id | (Optional) Post ID to pull the value from. Defaults to the current post. |
| default | Fallback if the custom field is empty. |
| before / after | HTML or text to wrap the output. |
| esc | Escaping mode: html (default), attr, or raw. |
| nl2br | Convert newlines to <br>. Defaults to true. |
| separator | If the field is an array or multiline text, this joins items (e.g., , ). |
๐งช Examples
[custom_field field="bio"]
[custom_field field="skills" separator=", "]
[custom_field field="team_members" separator=" / " before="<p>" after="</p>"]
๐ง Template Function
echo cfs_get( 'skills', [
'separator' => ', ',
'default' => 'No skills listed'
]);