yanknudtskov
1/22/2017 - 6:36 PM

Optimization Snippets

Optimization Snippets

<?php

/* .htaccess
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://www.broggerbelysning.dk/%{REQUEST_URI} [R,L]
*/


/**
 * Remove WP Emojis
 */
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');

remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );


/**
 * 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 = array();
	foreach ( $rates as $rate_id => $rate ) {
		if ( 'free_shipping' === $rate->method_id ) {
			$free[ $rate_id ] = $rate;
			break;
		}
	}
	return ! empty( $free ) ? $free : $rates;
}
add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 );


/**
 * Remove Enfold Google Web Fonts
 */
add_action( 'init', 'enfold_customization_switch_fonts' );
function enfold_customization_switch_fonts() {
    global $avia;
    $avia->style->print_extra_output = false;
}