Last active
January 22, 2024 17:08
-
-
Save strangerstudios/0ec01d2a9fc0b0f33896 to your computer and use it in GitHub Desktop.
Tests to check if you are on certain PMPro pages.
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 | |
global $pmpro_pages, $pmpro_level; | |
if(is_page($pmpro_pages['levels'])) { | |
//on the pricing/levels page | |
} | |
if(is_page($pmpro_pages['checkout'])) { | |
//on the checkout page | |
} | |
if(is_page($pmpro_pages['checkout']) && $pmpro_level->id == $level_id) { | |
//on a specific levels' checkout page | |
} | |
/* | |
When a checkout is processed, the pmpro_after_checkout hook is fired. | |
The only parameter is $user_id. | |
You can get the $level_id through global $pmpro_level->id or $_REQUEST['level'] | |
*/ | |
if(is_page($pmpro_pages['confirmation'])) { | |
//on the confirmation page | |
} | |
if(is_page($pmpro_pages['confirmation']) && !empty($_REQUEST['level']) && $_REQUEST['level'] == $level_id) { | |
//on the confirmation page for a specific level | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment