Shortcodes & Blocks
Frontend shortcodes and Gutenberg blocks for restricting content, showing membership status, displaying drip progress, and building member account pages.
FCHub Memberships provides 4 shortcodes and 2 Gutenberg blocks for adding membership-aware functionality to your frontend pages.
Shortcodes
A wrapping shortcode that shows or hides its inner content based on membership access.
Usage:
[fchub_restrict plan="pro"]
This content is only visible to Pro members.
[/fchub_restrict]Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
plan | string | '' | Comma-separated list of plan slugs. Member must have at least one of these plans |
resource_type | string | '' | WordPress resource type to check (e.g., post, page). Defaults to current post's type |
resource_id | string | '' | Resource ID to check. Defaults to current post ID |
message | string | '' | Custom restriction message for non-members. Falls back to the global default |
show_login | string | 'yes' | Show a login button for logged-out visitors (yes or no) |
drip_message | string | '' | Custom message for drip-locked content. Supports {date} placeholder |
Behavior:
- Not logged in — Shows the restriction message with an optional login button
- Logged in, no access — Shows the restriction message
- Logged in, drip locked — Shows the drip message with the unlock date
- Logged in, has access — Shows the wrapped content
Examples:
Restrict by plan:
[fchub_restrict plan="pro,enterprise"]
Premium content here.
[/fchub_restrict]Restrict with custom messages:
[fchub_restrict plan="pro" message="Upgrade to Pro to read this." drip_message="This lesson opens on {date}."]
Lesson content here.
[/fchub_restrict]Restrict by specific resource:
[fchub_restrict resource_type="page" resource_id="42"]
Content protected by page 42's membership rules.
[/fchub_restrict]Post Context
When resource_type and resource_id are not specified, the shortcode defaults to checking the current post. This means you can use [fchub_restrict plan="pro"] inside any post and it will check if the current user has the Pro plan.
Gutenberg Blocks
FCHub Memberships registers two Gutenberg blocks that provide the same functionality as the shortcodes but with a visual editor interface.
fchub-memberships/restrict Block
The content restriction block wraps inner blocks and restricts visibility based on membership.
Block Attributes:
| Attribute | Type | Description |
|---|---|---|
plan_slugs | string | Comma-separated plan slugs |
resource_type | string | Resource type to check |
resource_id | string | Resource ID to check |
restriction_message | string | Custom message for non-members |
This block uses server-side rendering — it calls the same Shortcodes::renderRestrict() method as the shortcode. In the block editor, you see a visual wrapper around the inner content with plan configuration in the sidebar inspector.
fchub-memberships/membership-status Block
Displays the membership status, equivalent to the [fchub_membership_status] shortcode.
Block Attributes:
| Attribute | Type | Description |
|---|---|---|
display | string | compact or full |
Also uses server-side rendering via Shortcodes::renderMembershipStatus().
Editor Assets
The block editor loads:
assets/js/blocks.js— block registration scripts (depends onwp-blocks,wp-element,wp-block-editor,wp-components,wp-i18n)assets/css/frontend.css— shared frontend and editor styles
Frontend CSS
All shortcodes and blocks enqueue fchub-memberships-frontend stylesheet (assets/css/frontend.css). This provides styling for:
.fchub-membership-restricted— restriction message container.fchub-plan-badge— plan name badges.fchub-drip-progress— progress bar track and fill.fchub-content-library— content list in account page.fchub-content-locked— locked content items with dates.fchub-btn— button styling (login, CTA).fchub-membership-account— account page layout.fchub-membership-history— history section
The CSS uses neutral colors and clean layout. You can override any styles in your theme's stylesheet since the plugin styles use standard specificity.
Email Notifications
Design branded membership emails, preview them with realistic member data, send tests, or hand each lifecycle moment to FluentCRM.
FluentCRM Integration
Deep integration with FluentCRM — 15 automation triggers, 7 actions, 7 benchmarks, 25+ smart codes, profile sections, and segment filters.