Skip to content

Instantly share code, notes, and snippets.

View kimwhite's full-sized avatar

Kim White kimwhite

View GitHub Profile
@kimwhite
kimwhite / minh-my_login_change_text_with_gettext.php
Last active August 20, 2025 14:56 — forked from JarrydLong/minh-my_login_change_text_with_gettext.php
Change / Translate login page text strings with the gettext filter
<?php // do not copy this line
/**
* This recipe changes login page text strings with the gettext filter
*
* 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/
*/
@kimwhite
kimwhite / my_add_extra_expiration_warning_templates.php
Last active July 10, 2025 13:25 — forked from ideadude/my_add_extra_expiration_warning_templates.php
Send extra expiration warning emails with individual templates when using PMPro and the Extra Expiration Warning Emails add on.
<?php
/**
* Send extra expiration warning emails with individual templates.
* Make sure the Extra Expiration Warning Emails Add On is also active.
* https://www.paidmembershipspro.com/add-ons/extra-expiration-warning-emails-add-on/
*
* Then add this code into a custom plugin or code snippet.
* https://www.paidmembershipspro.com/how-to-add-code-to-wordpress/
*/
// Tell the expiration warnings add on to use our templates.
@kimwhite
kimwhite / only-discount-woocommerce-specific-categories.php
Last active July 3, 2025 14:16 — forked from travislima/exclude-discount-woocommerce-categories.php
Apply membership discount for products by a specific category (all other categories excluded)
<?php // do not copy this line.
/**
* Apply membership discount ONLY to Woo products in specific allowed categories.
* All other categories will use the original (non-discounted) price.
*
* 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/
*/
@kimwhite
kimwhite / logout_url_redirect_pmpro.php
Last active June 26, 2025 18:00 — forked from JarrydLong/logout_url_redirect_pmpro.php
Redirect logout to PMPro login page.
<?php
// Copy from below here...
/*
* Redirect logout to custom page with slug 'logout'.
*/
function my_logout_url_redirect_custom( $logout_url ) {
$redirect_url = home_url( '/logout/' ); // Adjust slug if needed
$logout_url = add_query_arg( 'redirect_to', urlencode( $redirect_url ), $logout_url );
@kimwhite
kimwhite / banner-expired-membership.php
Last active June 20, 2025 12:26 — forked from ipokkel/banner-expired-membership.php
Display a notification banner for members with an expired membership. #paid-memberships-pr #pmpro
<?php
/**
* Display a renewal reminder notification banner at the top of your website
* for members whose Level 10 membership has expired. Change Line 62 to your level ID
* Edit Line 65 with your custom message and link. Update CSS to your colors etc.
*
* 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/
<? php
/**
* Restrict post access to specific user IDs or user Roles.
*
* 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/
*/
/**
<?php //do not copy
/**
* Gets the next payment date and marks that as the expiration date for users.
*
* The "next payment" value is an estimate based on the billing cycle of the subscription and the last order date. It may be off from the actual recurring date set at the gateway, especially if the subscription was updated at the gateway.
*
* Remove the // on line 40 to run the update query.
*
* Add /wp-admin/?set_expiration_dates=true to your URL to run.
*
<?php // do not copy
/**
* This recipe will display a list of pages/posts that are protected by adding the shortcode `[mypmpro_display_posts]` to a page.
*
* 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/
*/
@kimwhite
kimwhite / add_username_hint_at_checkout.php
Last active March 24, 2025 15:47 — forked from dparker1005/add_username_hint_at_checkout.php
Adds a hint under the "Username" field at checkout.
<?php // do not copy this line.
/**
* This recipe Adds a placeholder hint inside the "Username" field at checkout.
*
* 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/
*/
@kimwhite
kimwhite / set-initial-price-for-members.php
Last active February 28, 2025 14:10 — forked from andrewlimaza/set-initial-price-to-0-for-members.php
Set the initial amount to $0 for existing members.
<?php
/**
* Set the initial price to xxx for members only, for specific levels.
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_adjust_initial_amount( $level ) {
// Define different prices for specific levels
$level_prices = array(