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

In prior releases of PMPro, loading a custom template was an extensive coding challenge. To load templates from somewhere outside your theme’s /paid-memberships-pro/ directory, you had to create a separate filter and callback for each template to override. If you were editing multiple templates, you would have a lot of similar code filling up your customizations plugin.

We now offer the pmpro_pages_custom_template_path filter which tells PMPro 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 continue to look in the theme and default pages folder.

To keep adjustments outside of your theme folder, create a plugin for PMPro Customizations and add a folder named /pages/. 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.

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.

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?

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 *