Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Last active November 19, 2020 04:26
Show Gist options
  • Save ronalfy/5382ffe1d659ada9a84a7666312ecc7d to your computer and use it in GitHub Desktop.
Save ronalfy/5382ffe1d659ada9a84a7666312ecc7d to your computer and use it in GitHub Desktop.
Paid Memberships Pro - MMPU Override Levels Template
<?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 );
@ronalfy
Copy link
Author

ronalfy commented Oct 8, 2020

This only works with MMPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment