Archives: Snippets
Add custom CSS in the Admin
add_action( ‘admin_head’, function() { ?>Continue reading
Let Customers Select Their User Role From A Custom Field In Wholesale Lead Capture
function wws_wwlc_auto_select_role ($user) { //get the selected role $selected_role = get_user_meta($user->ID, ‘wwlc_cf_select_role’, true); // Change to match your custom field. $defaultRole = get_option( ‘wwlc_general_new_lead_role’ ); if ($selected_role) { $user->remove_role( $defaultRole ); $user->add_role( $selected_role ); } } add_action( ‘wwlc_action_after_approve_user’, ‘wws_wwlc_auto_select_role’ );Continue reading
Auto Generate Virtual Coupon After a Customer Completed an Order
/** * Generate a virtual coupon when order is completed. * * @param int $order_id Order ID. */ function acfwp_create_virtual_coupon( $order_id ) { $order = wc_get_order( $order_id ); $customer_id = $order->get_customer_id(); $create_date = date( ‘Y-m-d H:i:s’, current_time(‘timestamp’)); $expire_date = date(…Continue reading
Untitled Snippet
WooCommerce Wholesale Lead Capture Re-send Email Button in User Profile
/*********************************************************************************** * WooCommerce Wholesale Lead Capture Re-send Email Button in User Profile * *********************************************************************************/ function wwlc_add_resend_email_button() { if ( ! is_plugin_active( ‘woocommerce-wholesale-lead-capture/woocommerce-wholesale-lead-capture.bootstrap.php’ ) ) { return; } ?> Re-send wholesale lead email Wholesale application receivedWholesale account approvedWholesale account rejected Send…Continue reading
Insert Template at the Bottom of the Mobile Menu
/** * Insert template at the bottom of the mobile menu. */ add_action( ‘wpex_hook_mobile_menu_bottom’, function() { echo do_shortcode( ‘[wpex_template id=”YOUR_TEMPLATE_ID”]’ ); } );Continue reading
Genesis theme – use block editor in widgets
//* Genesis Enable the block-based widget editor add_filter( ‘use_widgets_block_editor’, ‘__return_true’ );Continue reading
Untitled Snippet
Remove address from the header
function wcvendors_remove_address( $address){ unset($address); return $address ; } add_filter( ‘wcv_format_store_address_output’, ‘wcvendors_remove_address’ );Continue reading