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 | |
/** | |
* Bypasses all content restriction for posts, pages, blocks and shortcodes that are on certain pages. | |
* Tweak this code further for your needs. | |
* To add this code to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_allowed_posts() { | |
$open_post_ids = array( 118 ); // Add all the POST ID's that you want to bypass here. | |
return $open_post_ids; |
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 | |
/** | |
* Add recurring text after Variable Pricing text. | |
* Tweak the wording for your needs. | |
* | |
* To add this code to your site please visit - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_vp_text_adjustment( $text ) { | |
$level = pmpro_getLevelAtCheckout(); | |
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 | |
/** | |
* Keep pre-existing members on their initial checkout price when manually renewing. Grandfather 'old' members when their levels pricing changes. | |
* Note: This is not needed for recurring membership levels and is designed for levels with an expiration date. | |
* | |
* 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/ | |
*/ |
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 | |
/** | |
* Support Set Expiration Date Add On for PMPro WooCommerce Add On. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmprowoo_set_expiration_date( $level_array ) { | |
// Make sure Set Expiration Date Add On is active. | |
if ( ! function_exists( 'pmpro_getSetExpirationDate' ) ) { | |
return $level_array; |
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 | |
/** | |
* This will allow you to charge additional extras on the user's monthly membership fee. | |
* Copy the code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
//we have to put everything in a function called on init, so we are sure Register Helper is loaded | |
function my_pmprorh_init() | |
{ |
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 | |
/** | |
* This code snippet will hide billing fields from certain levels when added using the "Capture Name & Address for Free Levels or for Offsite Gateway" | |
* Please adjust the level ID's values of the $levels_to_hide array, for which levels you want to hide billing fields from. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_hide_billing_fields_for_levels() { | |
$levels_to_hide = array(1,3,5); //change level ID's you want to hide billing fields from. |
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 | |
/** | |
* Adds the AddOn Package post meta to 'Series' post type. | |
* Give access if they purchased "Series" parent container. | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function add_pmpro_series_to_AP( $types ) { | |
$types[] = 'pmpro_series'; |
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 | |
/** | |
* Redirect to a default "members" page unless redirecting back to referrer. | |
* Adjust the URLS for $skip_redirects which it bypasses. | |
* | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_login_redirect_url( $redirect_to, $request, $user ) { | |
// Skip certain redirect_tos always | |
$skip_redirects = array( |
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 | |
/** | |
* Replace wp-login.php with a custom slug in all WordPress emails where it's generated. | |
* Add this code to a custom plugin or a child theme's functions.php | |
*/ | |
function my_replace_wp_login_in_emails($args) { | |
// Check if the message contains 'wp-login.php' | |
if (strpos($args['message'], 'wp-login.php') !== false) { | |
// Replace 'wp-login.php' with 'my-login' | |
$args['message'] = str_replace('wp-login.php', 'my-login', $args['message']); // change my-login to the slug of your choice |
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 | |
/** | |
* If anyone created a custom print.css file, add this code to a custom plugin to re-enqueue it in your theme or template directory. | |
*/ | |
function my_enqueue_print_style() { | |
if ( file_exists( get_stylesheet_directory() . '/paid-memberships-pro/css/print.css' ) ) { | |
$print_css = get_stylesheet_directory_uri() . '/paid-memberships-pro/css/print.css'; | |
} elseif ( file_exists( get_template_directory() . '/paid-memberships-pro/print.css' ) ) { | |
$print_css = get_template_directory_uri() . '/paid-memberships-pro/print.css'; | |
} else { |
NewerOlder