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
/** | |
* Force Admin Color Scheme on admin pages for a user account based on the site we're on. | |
* Valid admin_color values include: | |
* - fresh (Default) | |
* - light | |
* - modern | |
* - blue | |
* - coffee | |
* - ectoplasm | |
* - midnight |
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
add_filter( 'sdwoo_discount_code', 'custom_subscriber_discount_code', 10, 2 ); | |
function custom_subscriber_discount_code( $final_code, $email_address ) { | |
// Start a new discount code. | |
$new_code = '10OFF-'; | |
// Maximum length of the random string of characters after the new code. | |
$max_length = 4; | |
// Choose a random starting point to shorten the string to help avoid repeated strings. | |
$rand_start = rand( 0, 6 ); |
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
add_action( 'edd_before_purchase_form', 'sd_set_purchase_limit_error' ); | |
function sd_set_purchase_limit_error(){ | |
$user_id = get_current_user_id(); // Get the current customer's ID | |
$downloads = edd_get_users_purchased_products( $user_id ); // Get all of the products the customer has purchased in the past | |
$can_checkout = true; // Allow checkout for now | |
$download_ids = array( 1,2,3 ); //Whatever the IDs are that you want to check for | |
foreach ( $download_ids as $download_id ){ | |
$in_cart = edd_item_in_cart( $download_id ); // Check to see if our download is in the customer's cart. Change 57 to your download's ID. | |
if ( $in_cart == true ){ // If the item isn't in the customer's cart we don't need to go any further. |
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
// Add this to your theme's functions.php file or a custom plugin. | |
add_action( 'woocommerce_checkout_update_order_meta', 'conditional_checkout_field_pro_update_order_meta_blank_entries_only' ); | |
function conditional_checkout_field_pro_update_order_meta_blank_entries_only( $order_id ) { | |
global $wpdb, $cwcfp_db_table; | |
$fields = $wpdb->get_results("SELECT * FROM " . $cwcfp_db_table . " ORDER BY id;"); | |
//Check to see if the checkout has been processed already or not | |
$did_process = get_post_meta( $order_id, '_cwcfp_did_process', true ); | |
switch ( $did_process ) { |
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
// Copy below into your child theme's functions.php or into a custom plugin. | |
// Change the days of the week to French | |
add_filter( 'cwcfp_datepicker_day_names', 'my_custom_day_names' ); | |
function my_custom_day_names( $days ){ | |
$new_days = array( | |
'Dimanche', | |
'Lundi', | |
'Mardi', | |
'Mercredi', |
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
'cwcfp_datepicker_append_text' Default: '' | |
'cwcfp_datepicker_auto_size' Default: false | |
'cwcfp_datepicker_button_image' Default: '' | |
'cwcfp_datepicker_button_image_only' Default: false | |
'cwcfp_datepicker_change_month' Default: true | |
'cwcfp_datepicker_change_year' Default: true | |
'cwcfp_datepicker_close_text' Default: 'Done' | |
'cwcfp_datepicker_constrain_input' Default: true | |
'cwcfp_datepicker_current_text' Default: 'Today' | |
'cwcfp_datepicker_date_format' Default: 'MM d, yy' |
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
add_filter( 'wpcrm_system_zapier_contact_data_filter', 'get_contacts_company_url' ); | |
function get_contacts_company_url( $data, $post_id ){ | |
// get the organization's ID number | |
$org_id = get_post_meta( $post_id, '_wpcrm_contact-attach-to-organization', true ); | |
// retrieve the organization's website URL and add to the $data array | |
$data['orgurl'] = get_post_meta( $org_id, '_wpcrm_organization-website', true ); | |
// return $data | |
return $data; | |
} |
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 "normalize" the postcode entered by the customer, if the country seleced is Poland. | |
* Normalize meaning that it doesn't matter if they entered the post code as xx-xxx or xxxxx the | |
* function will be able to format it correctly. Once a "normalized" postcode is generated, the | |
* function will add a hyphen (-) in between the 2nd and 3rd numbers in the post code. | |
* This will always generate a xx-xxx formatted postcode. | |
*/ | |
add_filter( 'woocommerce_format_postcode', 'sd_add_poland_post_code_format', 10, 2 ); | |
function sd_add_poland_post_code_format( $postcode, $country ){ | |
$postcode = wc_normalize_postcode( $postcode ); |
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
add_filter( 'wpcrm_system_client_area_registration_redirect', 'my_url_redirect' ); | |
function my_url_redirect( $url ){ | |
$url = 'https://google.com'; | |
return $url; | |
} |
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_filter( 'cwcfp_radio_input_filter', 'custom_radio_button_field', 10, 4 ); | |
function custom_radio_button_field( $option_key, $option_text, $key, $value ){ | |
$options = '<label class="radio-input block">' . $option_text . '</label><input type="radio" name="' . $key . '" id="' . $key . '" value="' . $option_key . '" ' . selected( $value, $option_key, false ) . 'class="select">' . $option_text . "\r\n"; | |
return $options; | |
} |
NewerOlder