Remove Post Title from Yoast Breadcrumbs

// Remove post title from yoast breadcrumbs add_filter(‘wpseo_breadcrumb_single_link’, function( $link_output) { if( strpos( $link_output, ‘breadcrumb_last’ ) !== false ) { $link_output = ”; } return $link_output; } );Continue reading

Disable Auto-generated Image Sizes

// Disable Auto Generated Images Sizes add_action(‘intermediate_image_sizes_advanced’, ‘disable_image_sizes’); function disable_image_sizes($sizes) { //unset($sizes[‘thumbnail’]); //unset($sizes[‘medium’]); //unset($sizes[‘large’]); unset($sizes[‘medium_large’]); unset($sizes[‘1536×1536’]); unset($sizes[‘2048×2048’]); return $sizes; } add_action(‘init’, ‘disable_other_image_sizes’); function disable_other_image_sizes() { remove_image_size(‘post-thumbnail’); remove_image_size(‘another-size’); } add_filter(‘big_image_size_threshold’, ‘__return_false’);Continue reading

Use Full Store Address in Ships From

add_filter( ‘wcv_product_ships_from’, ‘ships_from_address’ ); function ships_from_address( $field ){ global $post, $product; $shipping_disabled = wc_string_to_bool( get_option( ‘wcvendors_shipping_management_cap’, ‘no’ ) ); $post = get_post( $product->get_id() ); if ( $product->needs_shipping() && ! $shipping_disabled && WCV_Vendors::is_vendor( $post->post_author ) ) { $vendor_id = WCV_Vendors::get_vendor_from_product( $product->get_id()…Continue reading

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