Last active
November 19, 2020 04:26
-
-
Save ronalfy/5382ffe1d659ada9a84a7666312ecc7d to your computer and use it in GitHub Desktop.
Paid Memberships Pro - MMPU Override Levels Template
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
<?php | |
/** | |
* The recipe checks for a /paid-memberships-pro/pages/levels.php in the child theme | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_pmprommpu_override_user_pages( $templates, $page_name, $type, $where, $ext ) { | |
if ( 'levels' !== $page_name && 'checkout' !== $page_name ) { | |
return $templates; | |
} | |
$pmpro_levels_page = get_stylesheet_directory() . "/paid-memberships-pro/pages/{$page_name}.{$ext}"; | |
if ( file_exists( $pmpro_levels_page ) ) { | |
$templates = array( $pmpro_levels_page ); | |
} | |
return $templates; | |
} | |
add_filter( 'pmpro_pages_custom_template_path', 'my_pmpro_pmprommpu_override_user_pages', 11, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This only works with MMPU.