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 Admin Editor Add On.

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.

Read the full documentation on using custom PMPro page templates »


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 loading a template in a plugin of your own, you could be using the PHP require() or include() functions. You could also use the WordPress get_template_part() function.

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 Email Templates Admin Editor Add On, 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 /wp-content/themes/your-theme/paid-memberships-pro/email/name.html.

Note that we use “email” without an S for our email folder but “pages” with an S for the pages folder.

We’re going to be adding some extra helper functionality around creating new email templates and integrating them with the Email Templates Admin Editor so users can easily override the email templates your addons use. When we get that done, we’ll post to the blog here. In the meantime, we can help in the member forums.

When a member wants to download/print an invoice I need to add me Business Name and ABN No. (Business Number) so they can claim the tax. How do I add these details to every invoice generated in a membership account displays this?
Thank in advance

I need to create different emails for free members vs paid members for the expired and expiring emails:

Currently i have these that go to all members.
“Membership Expired”
and
“Membership Expiring”

What i would like is that all paid members get the emails above but the free members get new emails called:
“Membership Free Expiring”
and
“Membership Free Expired”

I would like these new emails to show up in the admin area as shown in screen shot at URL below.
https://www.lymedisease.org/emails/addemails.jpg

I know how to create the html emails, i just don’t know to include them in the admin areas as well as doing the coding so that the new emails only go out to free members and the current emails go out only to paid members (free members will no longer receive these)

thank you for your help

This will require advanced development – if you have developer experience I would suggest looking at how other Add Ons extend the Email Templates Admin Editor and add their email templates to that dropdown. The logic to send the different email would need to be coded as a separate function. This guide shows you how to swap the checkout email but would be a good place to start in creating the custom code for your filter on the expiration notices: https://www.paidmembershipspro.com/customize-membership-checkout-confirmation-email-membership-renewals/.

I am trying to customize the Member Directory Add On profile page. I have tried putting the profile.php in both /my_theme_name/paid-memberships-pro/pages/ and /my_theme_name/pmpro-member-directory/templates/, but neither way seems to work.
Can you point me in the right direction?

WOW this is great! I’m working on an addon plugin now which will have a new email template and was wondering how best to include it with the Email Templates Admin Editor. Look forward to more.

Leave a Reply

For faster support related to issues on your specific site please open a ticket in our members support area.

Your email address will not be published. Required fields are marked *