Custom Tab Order For Dashboard

add_filter( ‘wcv_dashboard_pages_nav’, ‘change_nav_order’); function change_nav_order( $pages ){ $new_nav_order = array(); $new_nav_order[‘dashboard_home’] = $pages[‘dashboard_home’]; $new_nav_order[‘order’] = $pages[‘order’]; $new_nav_order[‘product’] = $pages[‘product’]; $new_nav_order[‘rating’] = $pages[‘rating’]; $new_nav_order[‘shop_coupon’] = $pages[‘shop_coupon’]; $new_nav_order[‘settings’] = $pages[‘settings’]; $new_nav_order[‘view_store’] = $pages[‘view_store’]; return $new_nav_order;Continue reading

Multipost Query Loop

add_filter( ‘generateblocks_query_loop_args’, function( $query_args, $attributes ) { $attributesArray = array_column($attributes[‘htmlAttributes’], ‘value’, ‘attribute’); if (isset($attributesArray[‘data-posts’])) { $posts = explode(‘,’, $attributesArray[‘data-posts’]) ?? []; return array_merge( $query_args, array( ‘post_type’ => $posts, ) ); } return $query_args; }, 10, 2 );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

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

Hot Topics #2

add_shortcode( ‘dtv_hot_topics_2’, function ($atts) { // css -> /wp-content/themes/smart-mag/css/custom.css extract(shortcode_atts(array( ‘posts’ => 10, ‘sidebar’ => 0, ‘home’ => 0, ‘trending’ => 0, ‘multi’ => 0, ), $atts)); $postitems = $posts; $big_top = true; if($multi) { if (defined(‘LSCWP_V’)) { do_action( ‘litespeed_tag_add’,…Continue reading

Disable Complianz for logged in users

function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required) { //don’t show cookie banner for logged in users if ( is_user_logged_in() ) { $cookiewarning_required = false; if (!defined(‘CMPLZ_DO_NOT_BLOCK’) ) define(‘CMPLZ_DO_NOT_BLOCK’, true); } return $cookiewarning_required; } add_filter( ‘cmplz_site_needs_cookiewarning’, ‘cmplz_my_filter_site_needs_cookiewarning’ );Continue reading