Add the Member’s level ID to the body class for level-specific CSS styles.

The code example below will allow you to add the logged-in member’s level ID (if available) to your site’s body class. This can prove useful if you want to change the style of or even hide elements based on level.


Default Body and Post Classes

WordPress offers several functions that can filtered by plugins to add classes to your site’s body element and posts elements. Below are the default filters Paid Memberships Pro adds to these elements:

Classes already added using the body_class Function

Membership Requirement-related
  • pmpro-body-level-required
    Added if the post requires membership.
  • pmpro-body-has-access
    Added if the logged in user has access to the members-only content.
  • pmpro-body-level-$levelID
    Added for each membership level the post requires.

Plugin Page-related
These classes will be added based on the plugin page settings.
  • pmpro-account
  • pmpro-billing
  • pmpro-cancel
  • pmpro-checkout
  • pmpro-invoice
  • pmpro-levels


The Code Recipe

This code recipe requires a Plus Account or higher.

View Membership Options

Let members access your original homepage when using the Member Homepages Add On.

The code example below will allow logged in Members the ability to access your original homepage when using our Member Homepages Add On.

This page requires a PMPro Core Account or higher.

Already have an account? Login Now »

New to this site? Register Now »

Prevent users from using an email address as their username.

The code example below will prevent users from setting their username to an email address. This is useful if you want users to use an actual username instead of using their email address in both username and email fields.

This page requires a PMPro Core Account or higher.

Already have an account? Login Now »

New to this site? Register Now »

Add “Select a Payment Plan” box to membership checkout (code demo)

Do you offer three different payment options for the same membership access? This new code gist allows you to easily add a selection box to the checkout page.

select-payment-plan

The code example below shows you how to define level “groups”—levels that are related and should appear as payment plans on the membership checkout page.


Video Demo


The Code Recipe

This code recipe requires a Plus Account or higher.

View Membership Options