Hide Shipping Methods

/** * Hide shipping rates when free shipping is available. * Updated to support WooCommerce 2.6 Shipping Zones. * * @param array $rates Array of rates found for the package. * @return array */ function my_hide_shipping_when_free_is_available( $rates ) { $free…Continue reading

Edit Lost Password Text

function change_lost_your_password ($text) { if ($text == ‘Lost your password?’){ $text = ‘Reset/Forgot Password?’; } return $text; } add_filter( ‘gettext’, ‘change_lost_your_password’ );Continue reading

WP GraphQL取得数変更

add_filter( ‘graphql_connection_max_query_amount’, function ( int $max_amount, $source, array $args, $context, $info ) { // Bail if the fieldName isn’t avail if ( empty( $info->fieldName ) ) { return $max_amount; } // Bail if we’re not dealing with our target fieldName…Continue reading

Untitled Snippet

$_SESSION[‘PFC_loggedin’] = true; //2023-4-30 KIRK SCHMITT TO USE STANDARD THEME TO START INDEPENDENT PHP PROCESS //INSERT [PFC_shortcode1] ON PAGE //FROM https://stackoverflow.com/questions/18896146/insert-php-code-in-wordpress-page-and-post function PFC_function_1() { $output = “”; if($_SESSION[‘PFC_loggedin’]) { $output .= ‘LOGOUT‘; $output .= ‘Display Cylinder Data‘; $output .= ‘Enter…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

Disable zoom on product page

function remove_image_zoom_support_webtalkhub() { remove_theme_support( ‘wc-product-gallery-zoom’ ); } add_action( ‘wp’, ‘remove_image_zoom_support_webtalkhub’, 100 );Continue reading

Add text below price on product page

add_action( ‘woocommerce_product_meta_start’, ‘text_after_meta_start’ ); function text_after_meta_start(){ echo ‘  Beställ färgprovar Hemma hos dig inom 2 – 3 veckor Unik, stark och hållbar Tillverkas i vår egen verkstad i Malung-Sälen av lokalt virke Hög kvalitet till ett rättvist pris Personlig service…Continue reading

Moving product short description to under product image

remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_excerpt’, 20 ); add_action( ‘woocommerce_before_single_product_summary’, ‘start_left_side’, 5 ); function start_left_side() { print ‘ ‘.PHP_EOL; } add_action( ‘woocommerce_before_single_product_summary’, ‘woocommerce_template_single_excerpt’, 30 ); add_action( ‘woocommerce_before_single_product_summary’, ‘end_left_side’, 40 ); function end_left_side() { print ‘ ‘.PHP_EOL; print ‘ ‘.PHP_EOL; }Continue reading

Add top bar to Storefront Theme (PHP 1/2)

/** * Adds a top bar to Storefront, before the header. */ function storefront_add_topbar() { ?> Måttbeställt Tillverkade i vårt eget snickeri (Malung-Sälen) Hög kvalitet till ett rättvist pris Snabb leverans (2-3 veckor) <?php } add_action( 'storefront_before_header', 'storefront_add_topbar' );Continue reading