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
/* SET ACF MULTI-SELECT LIMIT & CUSTOM VALIDATION */ | |
function acf_validate_value_la_custom_select( $valid, $value, $field, $input ){ | |
if( !$valid ) { | |
return $valid; | |
} | |
if((is_countable($value)) && (count($value) > 4)) { | |
$valid = 'You can only select 4 custom badges.'; | |
} else { | |
$valid = true; | |
} |
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
/* REMOVE WOO CHECKOUT FIELDS */ | |
function custom_remove_woo_checkout_fields($fields) { | |
// remove billing fields | |
unset($fields['billing']['billing_first_name']); | |
unset($fields['billing']['billing_last_name']); | |
unset($fields['billing']['billing_company']); | |
unset($fields['billing']['billing_address_1']); | |
unset($fields['billing']['billing_address_2']); | |
unset($fields['billing']['billing_city']); | |
unset($fields['billing']['billing_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
/* REMOVE ALL WOO BILLING FIELDS FOR LOGGED IN USERS ONLY */ | |
function custom_override_checkout_fields( $fields ) { | |
if( is_user_logged_in() ) { | |
unset($fields['billing']); | |
$fields['billing'] = array(); | |
} | |
return $fields; | |
} | |
add_filter( 'woocommerce_checkout_fields', 'custom_override_checkout_fields' ); |
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
/* REMOVE WOO BILLING DETAILS HEADER FOR LOGGED IN USERS ONLY */ | |
function wc_order_review_strings( $translated_text, $text, $domain ) { | |
if( is_user_logged_in() ) { | |
switch ($translated_text) { | |
case 'Billing details' : | |
$translated_text = __( '', 'woocommerce' ); | |
break; | |
} | |
} | |
return $translated_text; |
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
/* REMOVE WOO EMPTY CART CHECKOUT ERROR MESSAGE */ | |
add_filter('woocommerce_checkout_redirect_empty_cart', '__return_false'); | |
add_filter('woocommerce_checkout_update_order_review_expired', '__return_false'); |
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
/* DISPLAY AVATAR AND USERNAME SHORTCODE */ | |
function custom_display_avatar() { | |
if (is_user_logged_in()) { | |
global $current_user; | |
wp_get_current_user(); | |
return get_avatar($current_user->ID, 96); | |
} | |
else { | |
return get_avatar('https://url-to-custom-default-avatar-img.webp'); | |
} |
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
/* ENQUEUE CUSTOM CSS/HIDE ELEMENT ON SPECIFIC PAGE */ | |
function ploa_add_custom_css() { | |
wp_enqueue_style('custom-css'); | |
if ( is_page(309)) { | |
$custom_css = ".payment-plan-61 .acf-field.acf-field-select.acf-field-62kjk9b59635b1b {display: none;}"; | |
wp_add_inline_style( 'custom-css', $custom_css); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'ploa_add_custom_css' ); |
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
/* FIX FOR WOO NO LOGOUT */ | |
function ploa_bypass_logout_confirmation() { | |
global $wp; | |
if ( isset( $wp->query_vars['customer-logout'] ) ) { | |
wp_redirect( str_replace( '&', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) ); | |
exit; | |
} | |
} | |
add_action( 'template_redirect', 'ploa_bypass_logout_confirmation' ); |
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
#MIGRATE BOOTSTRAP4 CLASSES TO BOOTSTRAP5 | |
set -x | |
set -e | |
migration_folder=$1 | |
find_regex=".*/*.tsx?|.*/*.scss?|.*/*.php?|.*/*.css?|.*/*.js?|.*/*.html?" | |
ignore_path="*/$1node_modules/*" | |
find $migration_folder -regextype posix-egrep -regex $find_regex -type f -not -path $ignore_path | xargs sed -i.bak -E '/[(class)(")]/{ | |
s/([mp])l(-[0-5])/\1s\2/g | |
s/([mp])r(-[0-5])/\1e\2/g | |
s/no-gutters/g-0/g |
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
/* WOO REMOVE & REPLACE SELECT2 STYLES TO BS */ | |
add_action('wp_enqueue_scripts', 'agentwp_dequeue_stylesandscripts', 100); | |
function agentwp_dequeue_stylesandscripts() { | |
if (class_exists('woocommerce')) { | |
wp_dequeue_style('selectWoo'); | |
wp_deregister_style('selectWoo'); | |
wp_dequeue_style('select2'); | |
wp_deregister_style('select2'); | |
wp_dequeue_script('selectWoo'); | |
wp_deregister_script('selectWoo'); |
OlderNewer