PHP: Shortcode to Show Current Balance

if (!function_exists(‘shortcode_show_credits’)) { /** * Shortcode to display MyCred balance with dynamic updates (default black text). */ function shortcode_show_credits($atts) { return generate_mycred_balance_shortcode($atts, ‘black’); } add_shortcode(‘show_credits’, ‘shortcode_show_credits’); } if (!function_exists(‘shortcode_show_credits_white’)) { /** * Shortcode to display MyCred balance with white text…Continue reading

PHP: Shortcode to Claim Daily Credits

/** * Shortcode to claim daily credits. */ function shortcode_claim_daily_credits() { if (!is_user_logged_in()) { return ‘ Please log in to claim your daily credits. ‘; } $user_id = get_current_user_id(); $last_claim = get_user_meta($user_id, ‘_last_daily_claim’, true); if ($last_claim === date(‘Y-m-d’)) { return…Continue reading

Prevent Duplicate Purchases

function pw_edd_prevent_duplicate_purchase( $valid_data, $posted ) { $cart_contents = edd_get_cart_contents(); foreach( $cart_contents as $item ) { if( edd_has_user_purchased( get_current_user_id(), $item[‘id’] ) ) { edd_set_error( ‘duplicate_item’, ‘You have already purchased this item so may not purchase it again’ ); } } }…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

muestra

http://bucketvisualizadorvplant.s3-website-us-east-1.amazonaws.com/practicas/Bombas-centr%C3%ADfugasContinue reading

Approving User Account After Completed PayPal Payment

/** * Approve user after PayPal payment status is Complete * * @link https://wpforms.com/developers/how-to-approve-a-user-after-a-paypal-payment/ */ function wpf_dev_activate_user_after_paypal_complete( $fields, $form_data, $payment_id, $data ){ // Add the field ID for the user’s account email $email_field = 3; // Stop editing $user =…Continue reading

Learn how to add Availability label ? in your WooCommerce website. This will help to notify customers how many products are available or if the product is stock out.

add_filter( ‘woocommerce_cart_item_price’, ‘filter_cart_item_price’, 10, 3 ); function filter_cart_item_price( $price_html, $cart_item, $cart_item_key ) { if( $cart_item[‘data’]->is_on_sale() ) { return $cart_item[‘data’]->get_price_html(); } return $price_html; } add_filter( ‘woocommerce_cart_item_subtotal’, ‘filter_cart_item_subtotal’, 10, 3 ); function filter_cart_item_subtotal( $subtotal_html, $cart_item, $cart_item_key ){ $product = $cart_item[‘data’]; $quantity =…Continue reading