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
Added if the post requires membership.
Added if the logged in user has access to the members-only content.
Added for each membership level the post requires.
These classes will be added based on the plugin page settings.
The Code Recipe
The code example below will allow logged in Members the ability to access your original homepage when using our Member Homepages Add On.
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.
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)….
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.
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.
Prevent non-members from viewing product prices or purchasing products from your WooCommerce store with this Code Recipe
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.
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.