MemberPress in Bricks

Updated on 25 Jul 2023

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 (coming soon)

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 524 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Conditional Section when Post has a Featured Image in Bricks

Conditional Section when Post has a Featured Image in Bricks

This Pro tutorial provides the steps to output a Section in Bricks on single posts (of any post type) only if the post has a…
Categories:
Pro
Filtering a Bricks Terms query on Term archive pages

Filtering a Bricks Terms query on Term archive pages

On product category archives, how to show product type names but only those that the current product category has.
Pro
Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

This Pro tutorial provides the steps to modify a ACF Repeater query loop to only output the rows for which a True / False type…
Categories:
How to create filters with IsotopeJS in Bricks (Part 2): Dynamic Image Galleries

How to create filters with IsotopeJS in Bricks (Part 2): Dynamic Image Galleries

This tutorial series will review how to create a dynamic filterable image gallery using the IsotopeJS library‘s features in Bricks. Requirements Create a custom taxonomy for your…
How to Remove Name and Website Fields in Bricks Comment Forms

How to Remove Name and Website Fields in Bricks Comment Forms

Updated on 14 Mar 2024 In the BricksLabs Facebook group a user asked: What is the best method to remove fields from the Bricks "Comments"…