Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Created November 6, 2020 22:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronalfy/d913f3cfafe7674404b10203ae06de30 to your computer and use it in GitHub Desktop.
Save ronalfy/d913f3cfafe7674404b10203ae06de30 to your computer and use it in GitHub Desktop.
PMPro - MMPU Override Checkout Page
<?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