Created
November 6, 2020 22:49
-
-
Save ronalfy/d913f3cfafe7674404b10203ae06de30 to your computer and use it in GitHub Desktop.
PMPro - MMPU Override Checkout Page
This file contains 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/checkout.php in the child theme | |
* Please keep checkout.php up to date as MMPU is updated. | |
* | |
* 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 ( 'checkout' !== $page_name ) { | |
return $templates; | |
} | |
// Place checkout.php in _child_theme_/paid-memberships-pro/pages/ | |
// Only works with MMPU. | |
// Can further customize this gist to override more templates. | |
$pmpro_checkout_page = get_stylesheet_directory() . "/paid-memberships-pro/pages/checkout.php"; | |
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