MemberPress in Bricks

Updated on 18 Nov 2024

MemberPress is one of the most popular and comprehensive membership plugins for WordPress and this is what we use here at BricksLabs and our other membership sites to create membership plans, take payments and serve protected content to paying members.

This Pro tutorial aims to be a useful resource for using MemberPress in Bricks sites.

What's covered:

  • Render elements that have a class of members-only only to members that have a specific membership or memberships.
  • Setting up including styling the Login and Account pages
  • Custom condition to render elements based on membership ID(s)
  • Making the sign-up forms on a custom membership page like our membership page work properly

Render elements that have a class of members-only only to members that have a specific membership or memberships

Content from the block editor is automatically protected by MemberPress.

If your Page Bricks template is set to also show Bricks content (as it should), note that out of the box it will be visible to everyone and not just to the members that should have access to it per one or more MemberPress rules.

After adding the following code, you could simply add members-only class for any element at its STYLE → CSS → CSS classes and that element will be output only for members that are set to have access to this Page.

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 561 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Condition for checking Bricks content

Condition for checking Bricks content

Only outputting Bricks content when a Page is built with Bricks, otherwise display WP content.
Categories:
Pro
Conditional Related Posts in Bricks

Conditional Related Posts in Bricks

How to output a section only if there is at least 1 related post for the current post being viewed.
Categories:
Pro
Filtering Meta Box Cloneable Group by Select Subfield for Multiple Bricks Query Loops with Conditional Output

Filtering Meta Box Cloneable Group by Select Subfield for Multiple Bricks Query Loops with Conditional Output

In the Bricks Facebook group a user asks: Consider this cloneable Meta Box field group for a Custom Post Type called Tour: with the Tour…
Pro
x Number of Random Bricks Query Loop Items(s) to be Shown Every x Hours

x Number of Random Bricks Query Loop Items(s) to be Shown Every x Hours

Showing how to display one random row of a Meta Box group for an hour and then output another random row.
Filtering Breadcrumbs in Bricks

Filtering Breadcrumbs in Bricks

Using the bricks/breadcrumbs/items filter to modify Bricks' breadcrumbs’ element programmatically.
Categories:
Pro
Outputting Only the First ACF Repeater Row in Bricks

Outputting Only the First ACF Repeater Row in Bricks

Updated on 12 Dec 2023 In the Bricks Facebook group a user asks: How can I display only the first entry from an ACF repeater?…
Conditional Output on the First Page of Archives in Bricks

Conditional Output on the First Page of Archives in Bricks

How to output an element on an archive page only if we're on the first page of the archive.
Categories: