css - Adding class to element in php code -


i given piece of code change variable prices on woocommerce store display "from" before price instead of range of prices.

here's code in question:

<?php 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);  } 

i'm looking way add class "from" text can add css change color , font of text i'm not quite sure how go , don't want mess function.php file , crash site.

any appreciated.

maybe should try this:

$prefix = '<span class="yourclass">' . sprintf('%s: ', __('from', 'iconic')) . '</span>'; 

simply souround from span custom class. don't know __()-function however: result string , can prepared additional markup.

it should work (if don't want : included in span:

$prefix = sprintf('<span class="yourclass">%s</span>: ', __('from', 'iconic')); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -