Hide shipping when free shipping is available

function my_hide_shipping_when_free_is_available( $rates ) { $free = array(); foreach ( $rates as $rate_id => $rate ) { if ( ‘free_shipping’ === $rate->method_id ) { $free[ $rate_id ] = $rate; break; } } return ! empty( $free ) ? $free :…Continue reading

Rewrite Breadcrumb Base

add_filter( ‘woocommerce_breadcrumb_defaults’, ‘jk_change_breadcrumb_home_text’ ); function jk_change_breadcrumb_home_text( $defaults ) { // Change the breadcrumb home text from ‘Home’ to ‘Schrammek’ $defaults[‘home’] = ‘Dr. Schrammek’; return $defaults; }Continue reading

Show local fonts in WP block editor

add_filter( ‘block_editor_settings_all’, function( $editor_settings ) { $css = wp_get_custom_css_post()->post_content; $editor_settings[‘styles’][] = array( ‘css’ => $css ); return $editor_settings; } );Continue reading

User ID in Dashboard

//Adds Custom Column To Users List Table function custom_add_user_id_column($columns) { $columns[‘user_id’] = ‘User ID’; return $columns; } add_filter(‘manage_users_columns’, ‘custom_add_user_id_column’); //Adds Content To The Custom Added Column function custom_show_user_id_column_content($value, $column_name, $user_id) { $user = get_userdata($user_id); if (‘user_id’ == $column_name) { return…Continue reading

Duplicate Page-Post-CPT

/** * Duplicate WordPress Posts, Pages, and Custom Post Types as Drafts * * This code snippet enables the duplication of WordPress posts, pages, and all registered custom post types (CPTs). * It adds a ‘Duplicate’ link to the row…Continue reading

Duplicate Page/Post/CPT

/** * Duplicate WordPress Posts, Pages, and Custom Post Types as Drafts * * This code snippet enables the duplication of WordPress posts, pages, and all registered custom post types (CPTs). * It adds a ‘Duplicate’ link to the row…Continue reading

Duplicate Page/Post/CPT

/** * Duplicate WordPress Posts, Pages, and Custom Post Types as Drafts * * This code snippet enables the duplication of WordPress posts, pages, and all registered custom post types (CPTs). * It adds a ‘Duplicate’ link to the row…Continue reading

Admin Color Scheme

add_filter(“get_user_option_admin_color”, “update_user_option_admin_color”, 5); function update_user_option_admin_color($color_scheme) { $color_scheme = “modern”; // Options are: // fresh // light // blue // coffee // ectoplasm // midnight // modern // ocean // sunrise return $color_scheme; }Continue reading