Discount Rules v2 – Customize the Sale flash to percentage

function woocommerce_sale_flash_from_woo_discount_rules_v2($html, $post, $product){ $discounted_price = apply_filters(‘advanced_woo_discount_rules_get_product_discount_price_from_custom_price’, false, $product, 1, 0, ‘discounted_price’, true); if($discounted_price !== false){ $percentage = round( ( ( $product->get_price() – $discounted_price ) / $product->get_price()) * 100 ); $html = ‘ -‘ . $percentage . ‘%’ . ‘…Continue reading

Discount Rules v2 – Customize the Sale flash to percentage

function woocommerce_sale_flash_from_woo_discount_rules_v2($html, $post, $product){ $discounted_price = apply_filters(‘advanced_woo_discount_rules_get_product_discount_price_from_custom_price’, false, $product, 1, 0, ‘discounted_price’, true); if($discounted_price !== false){ $percentage = round( ( ( $product->get_price() – $discounted_price ) / $product->get_price()) * 100 ); $html = ‘ -‘ . $percentage . ‘%’ . ‘…Continue reading

JetAppointment – Customize the time slot format

// Customize the time slot format for JetAppointment. // This filter modifies the format of time slots to display only the start time. add_filter( ‘jet-apb/time-slots/slots-html/slot-time-format’, function( $format ) { $format = ‘%4$s’; return $format; } );Continue reading

UTDT-logout2

function utdt_logout2() { $user_id = get_current_user_id(); $txt = sprintf($user_id = ” has been Logged out of Under the Dementia Tree.”); echo $txt; wp_destroy_current_session(); wp_clear_auth_cookie(); wp_set_current_user( 0 ); do_action( ‘utdt_logout2’, $user_id ); }Continue reading

Remove plugin deactivation

// Remove plugin deactivation for all users except ‘rubberduckers’ function rubberduckers_disable_plugin_deactivation($actions, $plugin_file, $plugin_data, $context) { // Get the current user $current_user = wp_get_current_user(); // Check if the current user’s username is NOT ‘rubberduckers’ if ($current_user->user_login !== ‘rubberduckers’) { // List…Continue reading

Change Text For Minimum Donation Message

/* * */ function change_min_donation_text( $text, $amount ) { return ‘ ‘ . __( ‘The minimum donation for this campaign is ‘, ‘charitable’ ) . charitable_format_money( $amount, false, true ) . ‘. ‘; } add_filter( ‘charitable_donationa_amount_notice’, ‘change_min_donation_text’, 10, 2 );Continue reading

Allow SVG Files Upload

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

JetFormBuilder – Enable Guest Post Upload

add_action( ‘jet-form-builder/media-field/before-upload’, /** * Fired before JetFormBuilder uploads a file for a Media field. * * @param \Jet_Form_Builder\Request\Fields\Media_Field_Parser $parser */ function ( $parser ) { // Extra guard: bail out if the expected object is not passed. if ( !…Continue reading