Forked from ipokkel/custom-level-text-per-level-id.php
Created
July 12, 2021 00:52
-
-
Save femiyb/bb850719776a61d825ef590e6928e564 to your computer and use it in GitHub Desktop.
Change level name and page title for a specific level checkout
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 | |
function my_custom_level_cost_text( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case 'Membership Level': | |
$translated_text = __( 'My Membership Level Name', 'paid-memberships-pro' ); | |
break; | |
} | |
return $translated_text; | |
} | |
function my_custom_checkout_text() { | |
global $pmpro_pages, $pmpro_level; | |
if ( 22 === intval( $pmpro_level->id ) ) { | |
add_filter( 'gettext', 'my_custom_level_cost_text', 10, 3 ); | |
?> | |
<script> | |
jQuery(document).ready(function () { | |
jQuery('h1.entry-title').text('My Custom Page Title'); | |
}); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_head', 'my_custom_checkout_text' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment