How it Works
This shortcode displays the Membership Levels just like the
[pmpro_levels] shortcode, with extended options for customizing the display.
- PMPro Plus members can install the add on via the Memberships > Add Ons admin page.
- Or, download the plugin file and upload the ‘pmpro-advanced-levels-shortcode’ directory to the ‘/wp-content/plugins/’ directory of your site.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Edit your Memberships Levels page and replace the
[pmpro_levels]shortcode with your customized
[pmpro_advanced_levels]shortcode described below.
Note this shortcode can be used anywhere on your site – not only on the Membership Levels page.
Shortcode Example and Attributes
[pmpro_advanced_levels levels="1,3,2" layout="3col" description="true" checkout_button="Sign Me Up!" price="full"]
- back_link: Optionally hide to “Return to Home” or “Return to Your Account” links below levels layout (default: true).
- checkout_button: The button text for the action button (default: Select).
- compare: Only for compare_table layout, shows the comparison item rows. See below for a demonstration.
- description: Show the level description; accepts “true” or “false” (default: true).
- discount_code: Optionally apply a discount code to your membership level pricing. accepts the discount code (default: none).
- expiration: Show the level expiration; accepts “true” or “false” (default: true).
- levels: A comma-separated list of membership level IDs to display, in the order you want to display them; can be a single level ID (default: all levels ordered by ascending ID).
- layout: How to display the levels; accepts “div”, “table”, “2col”, “3col”, “4col” or “compare_table” (default: div).
- price: How to display the level cost text. accepts “full”, “short” or “hide” (default: short).
- renew_button: The button text for the action button shown to existing members with an expiring level (default: Renew).
- template: Specify an integrated theme framework to inherit formatting. accepts “bootstrap”, “genesis”, “woo themes”, “gantry”, “pagelines” or “foundation” (default: none).
How to Set Up the Comparison Table Items
The unique shortcode attribute “compare” allows you to specify the rows of comparison items and display a checkmark, leave blank, or custom text for each level in your comparison table layout.
Here’s a sample of the “compare” attribute:
[pmpro_advanced_levels layout="compare_table" compare="Compare Item 1,1,1;Compare Item 2,0,1;Compare Item 3,0,1;Numerical Thing,10 Things,20 Things"]
The attribute “compare” accepts groups of comparison rows separated by a semi-colon (;) – in each group of comparison row, separate the label for the row and a “0” or “1” to show/hide a checkmark, or the text to show for that level. If this is confusing (and we know it kind of is), just open a topic in the support forums and we will help you get this working.
You can optionally include hyperlinks in the “compare” attribute as well (we do this on our own pricing page).
When using the
compare_table layout, row labels and row content can include hyperlinks. To do this, you must be careful with how your shortcode uses single (
') and double-quotes (
"). We do this on our own pricing page here.
- Use single quotes to wrap shortcode attributes:
- Use double quotes for the link items in the row labels:
compare='<a href="/item-1/">Item 1</a>,1,1;<a href="/item-2/">Item 2</a>,0,1'
Here is a full example of using hyperlinked row labels with the compare_table layout:
Available Hooks in the Advanced Levels Page Shorted
Hooks for the “div” and “column” layouts:
do_action( 'pmproal_before_level', int $level_id, int string $layout );
do_action( 'pmproal_after_level', int $level_id, int string $layout );
Hooks for the “table” layout:
do_action( 'pmproal_extra_cols_before_header' );
do_action( 'pmproal_extra_cols_after_header' );
do_action( 'pmproal_extra_cols_before_body' );
do_action( 'pmproal_extra_cols_after_body' );
Note: hooks have not yet been added for the compare_table layout
Integrated Theme Frameworks/Parent Themes
Below is a list of templates included in v1.7 of PMPro Advanced Levels Shortcode. Assign the appropriate “template” attribute for your theme/theme framework.
- Buttons will be formatted like the “primary” button in Bootstrap v3+ (class=”btn btn_primary”)
- Each level in the default or Two-Column layout will be wrapped in the “pane” class
- Two, Three and Four-Column layouts use the Bootstrap v3+ fluid responsive grid
- The table layout inherits table, striped, bordered formatting from Bootstrap v3+ (class=”table table-striped table-bordered”)
- Price is displayed like the “lead” class in Bootstrap v3+
- Buttons will be formatted like the default “button” class
- Each level in block layout will have spacing just like the “entry” class
- Two, Three and Four-Column layouts use the Genesis responsive grid
- The table layout inherits base table formatting in Genesis or your Genesis child theme
The demo is built using FoundationPress starter theme, which uses Foundation 5 by Zurb. If you’re using another theme built on Foundation 5 this template should also work.
- Buttons will be formatted like the basic, default button in Foundation 5 (class=”button”)
- Each level in the default or Two-Column layout will be wrapped in the “panel” class
- Three and Four-Column layouts use the Pricing Table layout in Foundation 5
- The table layout inherits the default table layout from Foundation 5
- Price in the default or Two-Column layout is displayed using the h5 subheader class
Note: I don’t own every child theme published by these third-parties and as have can only tested on the sample child themes, or base frameworks. If you experience problems working with this plugin and your theme, please post to the support forums.