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 »

Change “Pay by Check” wording to open up more payment options for members.

Our Pay by Check Add On adds a second payment option for members to make purchase by “Check”. With a little help from WordPress’ gettext filter, you can open up more payment options for your members. What types of changes can you make? In some parts of the world, “Check” is spelled “Cheque”. Alternately, you could use the Pay by Check Add On as a workaround to offer members the option to pay by bank transfer. This code recipe will help you rename “Check” to “Cheque,” “Pay by Bank Transfer,” “Send an Invoice” or any other messaging you desire. Our recipe below changes the words “Pay by Check” to “Pay by Cheque or Bank Transfer” on the Membership Checkout page. If you need this to say something else, edit the $translated_text variable on line 11. The Code Recipe https://gist.github.com/travislima/012893d789e57b5055bbc1570753ebf6 Customize and add this code to a helper PMPro Customizations plugin (our recommended method)….

This page requires a PMPro Core Account or higher.

Already have an account? Login Now »

New to this site? Register Now »

Styling the Checkout Page: Inline Labels and Inputs

v1.9.4 of Paid Memberships Pro introduced a table-free checkout page, improving the usability and display across device types and themes. This new layout placed the form’s input labels on their own line, above the input field.

The recipe below includes the necessary CSS to display these labels inline with the form inputs for large displays only.

Comparing the checkout page with and without the custom CSS for inline labels


The Code Recipe

You can also add this CSS directly into the ‘Additional CSS’ area of your WordPress Customizer. This is accessed via Appearance > Edit CSS in the WordPress Dashboard.

Note: Be sure to remove the <style> </style> tag when pasting this CSS into the “Additional CSS” block.

 

Turn your WooCommerce Store into a Catalog for Non Members 

Prevent non-members from viewing product prices or purchasing products from your WooCommerce store with this Code Recipe

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 levels “groups” – meaning these levels are related and should appear as payment plans on the membership checkout page. You can have more than one level group (i.e. Levels 1, 2, and 3 in one group and Levels 4, 5 and 6 in another.

This page requires a PMPro Core Account or higher.

Already have an account? Login Now »

New to this site? Register Now »