Custom Field Shortcode

๐Ÿ“ฆ 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

AttributeDescription
field(Required) The custom field (meta key) name.
post_id(Optional) Post ID to pull the value from. Defaults to the current post.
defaultFallback if the custom field is empty.
before / afterHTML or text to wrap the output.
escEscaping mode: html (default), attr, or raw.
nl2brConvert newlines to <br>. Defaults to true.
separatorIf 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'
]);