Archives: Snippets
MemberPress: Change default values for state and country fields on registration forms
(function($) { $(document).ready(function() { // Set defaults US, TX $(‘#mepr_signup_form #mepr-address-country’).val(‘US’).change(); $(‘#mepr_signup_form #mepr-address-state’).val(‘TX’).change(); }); })(jQuery);Continue reading
WP Simple Pay: Custom Button Color
.simpay-styled .simpay-form-control .simpay-btn:not(.stripe-button-el) { background-color: #0b749d; } .simpay-styled .simpay-form-control .simpay-btn:not(.stripe-button-el):focus, .simpay-styled .simpay-form-control .simpay-btn:not(.stripe-button-el):hover { background-color: #086285; }Continue reading
Custom Plugin for WPForms
Custom Receipt Page
add_filter( ‘charitable_permalink_donation_receipt_page’, ‘example_charitable_permalink_donation_receipt’, 999, 2 ); function example_charitable_permalink_donation_receipt( $value, $args ) { // The $value is the URL of the donation receipt page or whatever URL you want the user to go after a successful donation. // The $args array…Continue reading
Add WPCode Permalink Smart Tag
add_filter( ‘wpcode_smart_tags’, function( $tags ) { $tags[‘custom’] = array( ‘label’ => ‘Custom’, ‘tags’ => array( ‘permalink’ => array( ‘label’ => ‘Permalink’, ‘function’ => ‘wpcode_custom_permalink_tag’, ), ), ); return $tags; } ); function wpcode_custom_permalink_tag() { // Replace custom_field_tag below with the…Continue reading
MemberPress: Replace Country Code with Country Name
function mepr_replace_country_code_with_country_name ( $address, $user ) { $countries = require( MEPR_I18N_PATH . ‘/countries.php’ ); $addr1 = get_user_meta( $user->ID, ‘mepr-address-one’, true ); $addr2 = get_user_meta( $user->ID, ‘mepr-address-two’, true ); $city = get_user_meta( $user->ID, ‘mepr-address-city’, true ); $state = get_user_meta( $user->ID, ‘mepr-address-state’,…Continue reading
WP Simple Pay: BuddyBoss Preview Compatibility
/** * Plugin Name: WP Simple Pay – BuddyBoss Compatibility Fix */ if ( isset( $_GET[‘simpay-preview’] ) ) { remove_action( ‘bp_nouveau_enqueue_scripts’, ‘bp_nouveau_search_enqueue_scripts’ ); }Continue reading
WC Vendors Activate All Inactive Vendors
/** Activates all Vendor Stores **/ function wcv_activate_all_vendors() { global $wpdb; $vendors = get_users( array( ‘fields’ => array( ‘ID’ ), ‘role’ => ‘Vendor’ ) ); $meta_key = ‘_wcv_vendor_status’; foreach($vendors as $vendor){ $wpdb->query($wpdb->prepare(“UPDATE wp_usermeta SET meta_value=’active’ WHERE user_id=$vendor->ID AND (meta_key=’$meta_key’ AND…Continue reading
Add Custom Field From Donation Form On The Receipt Page
/** * Displays the donation summary ( updated to show custom fields ) * * Override this template by copying it to yourtheme/charitable/donation-receipt/summary.php * * @author WP Charitable LLC * @package Charitable/Templates/Donation Receipt * @since 1.0.0 * @version 1.4.7 */…Continue reading