Theme authors and developers often ask how to modify a membership email or plugin-generated page. Most templates can be adjusted using Action and Filter Hooks, custom stylesheet/CSS, and the email templates settings page.
Some customizations can only be achieved through a completely custom template. This article explains how to use the
pmpro_loadTemplate() function to load any of the plugin-generated pages or system-generated emails from a different location.
Overriding PMPro Page Templates
Paid Memberships Pro generates frontend page content via the shortcodes pmpro_account, pmpro_billing, pmpro_cancel, pmpro_checkout. pmpro_confirmation, pmpro_invoice, and pmpro_levels. If you cannot accomplish your customization needs via hooks and filters or a custom stylesheet/CSS and need finer control over the HTML code generated, then you might want to override the template files for these pages.
By default, Paid Memberships Pro will look in your active theme (and parent theme if applicable) for a directory named
/paid-memberships-pro/pages. You can copy any file from
/wp-content/plugins/paid-memberships-pro/pages/ folder into that theme location and tweak the files to your needs. PMPro will load your modified version of the template instead of the default one that is bundled with Paid Memberships Pro.
This way you can edit those files without breaking your changes when you upgrade Paid Memberships Pro later. There still made be additions or changes to our default templates that you will want to or need to change in your custom templates, but you’ll have less work to do than if you “hacked the core” PMPro plugin.
Loading Custom Page Templates From a Plugin Instead of Your Theme
PMPro uses the pmpro_pages_custom_template_path filter hook to check a specific directory for ALL page templates. If the template is found, it will be used. If it’s not found, PMPro will next look in the theme. If the theme does not include custom templates, the default plugin templates will be loaded.
To keep adjustments outside of your theme folder, create a plugin for PMPro Customizations and add a folder named
/templates/. Then add code to your
pmpro-customizations.php plugin file to tell PMPro to load these templates like this:
Creating Your Own Page Templates
If you are a developer building an extension for PMPro you can support the same method we offer to allow users to override your template by placing their own version in the
/paid-memberships-pro/pages/ directory of their theme or filtering the template location in a custom plugin. The correct function to use to load your template is
pmpro_loadTemplate(). Here is an example that you can use to load your template file. We’ll be updating our Add Ons to work the same way.
Customizing Member Emails
Every email that could possibly be sent through your Membership site can be adjusted to fit your needs. Read through the full list of system-generated emails to see all the possible emails that your membership site offers.
While our preferred way to edit these emails is through the Memberships > Settings > Email Templates page in the WordPress admin, you can also use the same methods described above for plugin or theme-loaded templates.
Loading Custom Email Templates From a Plugin Instead of Your Theme
Sometimes you need to programatically update email templates. Similar to filtering page templates, you can use the pmpro_email_custom_template_path filter like this:
You can also create your own email templates and load them using pmpro_loadTemplate(‘name’, NULL, ’email’); which will try to load email templates from
We’re going to be adding some extra helper functionality around creating new email templates so users can easily override the email templates your Add Ons use. When we get that done, we’ll post to the blog here. In the meantime, we can help in the member forums.
Related Reading: How to Customize the Frontend Pages
We have a few articles in our blog on how to adjust the appearance of your frontend membership pages. Check the links below to explore the guides:
- Making a Powerful Member Dashboard for Your Membership Account Page
- Create a Dual Login and Benefits of Registration Page
- Customizing the Paid Memberships Pro Membership Pricing Page
- How to Use a Page Builder to Create a Custom Membership Level Pricing Page
- Membership Pricing Pages and Streamlining the Checkout Process
- Using Page Builders to Enhance Your Site’s Membership Pages
- Design a Specific Level’s Membership Checkout Page Using CSS
- Customizing the Member Links list on Membership Account Page
- Add Links by Membership Level to the Membership Account Page “links” Section
- Customizing the Member Cancellation Process
- How to Load a Custom Template for Membership Pages or System-Generated Emails