Skip to content

Instantly share code, notes, and snippets.

View travislima's full-sized avatar

Travis Lima travislima

View GitHub Profile
@travislima
travislima / wp-config.php
Last active October 31, 2017 10:49
example-wp-debug.php
// Turn debugging on by setting value to "true"
define('WP_DEBUG', true);
// Turn off the display of error messages on your site
define('WP_DEBUG_DISPLAY', false);
// Log all errors to /wp-content/debug.log
define('WP_DEBUG_LOG', true);
@travislima
travislima / wp-config.php
Last active October 31, 2017 10:50
Turn WP Debug mode on
define( 'WP_DEBUG', true );
@travislima
travislima / pmpro_change_Invoice_on_print.php
Created December 7, 2017 12:50
Change "Invoice" to "Receipts"
<?php
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
* A simple gist that changes "Invoice #:" to "Receipt #:" when printing an exsisting order.
* Copy the code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Invoice #: ' :
@travislima
travislima / dark_theme_styling.css
Created January 10, 2018 11:08
Styling for a Dark WP Theme using PMPro (User Specific)
/* PMPro Levels Page - Button Styling */
a.pmpro_btn.pmpro_btn-select {
text-decoration: none;
text-transform: uppercase;
background-color: #D32D0B;
color: #ffffff;
border: none;
}
/* PMPro Levels Page - Table Background Color */
@travislima
travislima / my_gettext_membership.php
Last active May 22, 2018 12:04 — forked from andrewlimaza/my_gettext_membership.php
Change "Membership" to a different word with Paid Memberships Pro
// Change 'Membership' to 'Subscription' for Paid Memberships Pro.
function my_gettext_membership( $translated_text, $text, $domain ) {
if( "paid-memberships-pro" == $domain ) {
$translated_text = str_replace( "Membership Level", "Subscription", $translated_text );
$translated_text = str_replace( "membership level", "subscription", $translated_text );
$translated_text = str_replace( "membership", "subscription", $translated_text );
$translated_text = str_replace( "Membership", "Subscription", $translated_text );
}
return $translated_text;
}
@travislima
travislima / memberlite-banner-expiration-notification.php
Last active May 31, 2018 21:05
Display a banner that notifies users about their upcoming expiration - Memberlite method.
<?php
/**
* This code will display a renewal reminder notification banner at the top of your website for members whose membership
* level will expire within 7 days of the date they visit your site.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Note: When adding to your Customizations Plugin, be careful not to include the opening php tag on line 1 above.
*/
function memberlite_show_banner_renewal_message(){
@travislima
travislima / renew-link-button-change.css
Last active July 11, 2018 08:26
Change the Renew link of the PMPro My Account Page to a button using CSS.
@travislima
travislima / replace_spaces_with_underscores.php
Last active August 8, 2018 15:11 — forked from andrewlimaza/replace_spaces_with_underscores.php
Replace spaces with underscore "_" for usernames.
<?php // Do not copy this tag.
/**
* Replace all spaces with an underscore when new users register for Paid Memberships Pro.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_custom_user_registration_changes( $userdata ) {
$userdata['user_login'] = str_replace(' ', '_', $userdata['user_login'] );
@travislima
travislima / shortcode_membership_name.php
Last active September 4, 2018 11:52 — forked from andrewlimaza/shortcode_membership_name.php
Membership level name shortcode for Paid Memberships Pro
<?php //Do not copy this tag.
// Copy the function below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
// Use the shortcode [membership_level] to display the user's current membership level.
function pmpro_membership_level_shortcode( $atts ){
if(is_user_logged_in() && function_exists( 'pmpro_hasMembershipLevel' ) && pmpro_hasMembershipLevel()){
global $current_user;
$current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
return sprintf(__( "Your current level is: %s", "pmpro" ), $current_user->membership_level->name);
@travislima
travislima / change-howdy-admin.php
Last active November 15, 2018 05:33
Change the word "Howdy" to "Hello" in your WordPress Admin Bar
<?php //careful not to duplicate this tag in your customizations.functions.php file
/*
* Change the word "Howdy" to "Hello" in your WordPress Admin Bar.
* Add to a Customization Plugin of your choice.
* If a PMPro Member, you can add code to a Paid Memberships Pro Customizations Plugin.
*/
function wp_admin_bar_my_custom_account_menu( $wp_admin_bar ) {
$user_id = get_current_user_id();
$current_user = wp_get_current_user();