📜  产品页面挂钩中带有价格的产品标题 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:41.530000             🧑  作者: Mango

代码示例1
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );

function show_title_with_price()
{
    global $product;
    $title = $product->get_title();
    $price = $product->get_regular_price();
    $symbol = get_woocommerce_currency_symbol();

    //You may change 

tag or add any inline CSS here. echo "

$title: $symbol $price

"; } add_action( 'woocommerce_single_product_summary', 'show_title_with_price', 5 );