Created
March 22, 2021 19:20
-
-
Save ideadude/15c0955169eabdc414f8eee53405b661 to your computer and use it in GitHub Desktop.
Load your own templates for Paid Memberships Pro using a custom plugin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Include this code in your custom WordPress plugin | |
* to load your own versions of the PMPro page templates. | |
* To override the cancel.php template, place your own | |
* cancel.php template in a folder like this: | |
* ../plugins/yourpluginslug/templates/cancel.php | |
* | |
* Using priority 100 will make sure this runs after | |
* other code using the smae hook. For example, | |
* it will run later than the Reason for Cancelling Add On | |
* which uses priority 99. :) | |
*/ | |
function my_pmpro_page_templates( $templates, $page_name ) { | |
$templates[] = plugin_dir_path(__FILE__) . 'templates/' . $page_name . '.php'; | |
return $templates; | |
} | |
add_filter( 'pmpro_pages_custom_template_path', 'my_pmpro_page_templates', 100, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment