What You’ll Learn
- Using shortcodes to display field values
- Controlling field visibility settings
- Template integration for developers
- Styling custom field output
Method 1: Shortcodes
The easiest way to display custom field values anywhere.
Basic Shortcode
[bp-member-blog-custom-field id="field_key"]
Replace field_key with your actual field key (found in Custom Fields settings).
Shortcode Attributes
| Attribute | Description | Example |
|---|---|---|
id | Field key (required) | id="event_date" |
post_id | Specific post (default: current) | post_id="123" |
before | Text before value | before="$" |
after | Text after value | after=" USD" |
Example Shortcodes
Display event date:
[bp-member-blog-custom-field id="event_date"]
Display price with currency:
[bp-member-blog-custom-field id="price" before="$" after=" USD"]
Output: $49.99 USD
Display from a specific post:
[bp-member-blog-custom-field id="rating" post_id="456"]
Method 2: Field Visibility Settings
Control where each field appears using visibility options.
Visibility Options
| Setting | Form | Admin | Frontend |
|---|---|---|---|
| Frontend Only | Yes | No | Yes |
| Admin Only | No | Yes | No |
| Both | Yes | Yes | Yes |
Display on Frontend Toggle
Each field has a Display on Frontend toggle. When enabled, the field value automatically appears below the post content.
- On: Field value shows on published posts
- Off: Field value only accessible via shortcode or code
Method 3: Template Integration (Developers)
Access custom field values directly in theme templates.
Get Single Value
Date: ' . esc_html( $event_date ) . '';
}
?>
Get Gallery Images
';
foreach ( $gallery as $image_id ) {
echo wp_get_attachment_image( $image_id, 'medium' );
}
echo '