简体   繁体   中英

How to change the font size in php?

I'm trying to change the font size of the price including tax, not just the suffix 'incl. btw'. Is it possible to do that?

add_filter( 'woocommerce_get_price_suffix', 'bbloomer_add_price_suffix_price_inc_tax', 99, 4 );
       
function bbloomer_add_price_suffix_price_inc_tax( $suffix, $product, $price, $qty ){
    $suffix = ' excl. btw <br> ' . wc_price( wc_get_price_including_tax( $product ) ) . ' incl.btw';
    return $suffix;
}

As mentioned above you can use a span to control the font attributes. Like this

function bbloomer_add_price_suffix_price_inc_tax( $suffix, $product, $price, $qty ){
    $suffix = ' excl. btw <br> ' . 
              '<span style="font-size: large">'.
              wc_price( wc_get_price_including_tax( $product ) ) . ' incl.btw'.
              '</span>';
    return $suffix;
}

The code above is formatted for clarity. It shows the font as large , but you can use pixels or other units. That font size (or other attributes are only in-force within the span.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM