File: D:/HostingSpaces/Velosophe/dev.abloc.cc/wwwroot/app/themes/abloc-child/functions.php
<?php
/* Styles
=============================================================== */
function ab_child_theme_styles() {
// Enqueue child theme styles
wp_enqueue_style( 'nm-child-theme', get_stylesheet_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'ab_child_theme_styles', 1000 ); // Note: Use priority "1000" to include the stylesheet after the parent theme stylesheets
/**
* 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 );
/**
* Change price format from range to "From:"
*
* @param float $price
* @param obj $product
* @return str
*/
function iconic_variable_price_format( $price, $product ) {
$prefix = sprintf('%s: ', __('From', 'iconic'));
$min_price_regular = $product->get_variation_regular_price( 'min', true );
$min_price_sale = $product->get_variation_sale_price( 'min', true );
$max_price = $product->get_variation_price( 'max', true );
$min_price = $product->get_variation_price( 'min', true );
$price = ( $min_price_sale == $min_price_regular ) ?
wc_price( $min_price_regular ) :
'<del>' . wc_price( $min_price_regular ) . '</del>' . '<ins>' . wc_price( $min_price_sale ) . '</ins>';
return ( $min_price == $max_price ) ?
$price :
sprintf('%s%s', $prefix, $price);
}
add_filter( 'woocommerce_variable_sale_price_html', 'iconic_variable_price_format', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'iconic_variable_price_format', 10, 2 );
function demolium_widgets_init() {
register_sidebar( array(
'name' => 'Shop header',
'id' => 'shop_header',
'before_widget' => '<div class="header_block">',
'after_widget' => '</div>',
'before_title' => '<h2 style="display:none;">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'demolium_widgets_init' );
add_filter('use_block_editor_for_post', '__return_false', 10);