久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

僅在所有 WooCommerce 單一產(chǎn)品上顯示價格后綴

Show a price suffix only on all WooCommerce single products(僅在所有 WooCommerce 單一產(chǎn)品上顯示價格后綴)
本文介紹了僅在所有 WooCommerce 單一產(chǎn)品上顯示價格后綴的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在使用顯示僅在所有 WooCommerce 產(chǎn)品循環(huán)上的價格后綴 回答我上一個問題的代碼,以便在除產(chǎn)品詳細(xì)信息頁面 (WooCommerce) 之外的所有頁面上的價格后顯示價格后綴.

I am using Show Price Suffix only on all WooCommerce Product loops answer code to my previous question, to display a price suffix after the price on all pages except the Product Detail Page (WooCommerce).

我只想為產(chǎn)品詳細(xì)信息頁面添加另一個價格后綴.后綴應(yīng)包含鏈接且字體大小應(yīng)可編輯.

I want to have another price suffix only for the Product Detail Page. The suffix should include a link and the font size should be editable.

有人可以幫我嗎?

推薦答案

要僅使用自定義鏈接在單個產(chǎn)品上顯示價格后綴,請嘗試以下操作:

To display a price suffix on single products only with a custom link, try the following:

add_filter( 'woocommerce_get_price_suffix', 'additional_single_product_price_suffix', 999, 4 );
function additional_single_product_price_suffix( $html, $product, $price, $qty ){
    global $woocommerce_loop;

    // Not on single products
    if ( ( is_product() && isset($woocommerce_loop['name']) && empty($woocommerce_loop['name']) ) ) {
        // Define below the link for your price suffix
        $link = home_url( "/somelink.html" );

        $html .= ' <a href="' . $link . '" target="_blank" class="price-suffix">' . __('Suffix 2') . '</a>';
    }
    return $html;
}

內(nèi)聯(lián) CSS 樣式規(guī)則(可以添加到主題的 style.ccs 文件中):

Inline CSS style rules (can be added instead to the theme's styles.ccs file):

add_action('wp_head', 'product_price_suffix_css_styling_rules', 9999 );
function product_price_suffix_css_styling_rules() {
    // Only on single product pages
    if( is_product() ):
    ?><style>
        a.price-suffix, a.price-suffix:visited {font-size: 13px; color: #DC143C;}
        a.price-suffix:hover, a.price-suffix:active {color: #960404}
    </style><?php
    endif;
}

代碼位于活動子主題(或活動主題)的 functions.php 文件中.經(jīng)測試有效.

Code goes in functions.php file of your active child theme (or active theme). Tested and works.

如果價格后綴應(yīng)在文本中包含鏈接,請使用以下內(nèi)容:

If the price suffix should include a link inside the text, use the following:

add_filter( 'woocommerce_get_price_suffix', 'additional_single_product_price_suffix', 999, 4 );
function additional_single_product_price_suffix( $html, $product, $price, $qty ){
    global $woocommerce_loop;

    // Not on single products
    if ( ( is_product() && isset($woocommerce_loop['name']) && empty($woocommerce_loop['name']) ) ) {
        // Define below the link for your price suffix
        $link = home_url( "/somelink.html" );

        $html .= sprintf( ' <span class="price-suffix">' . __('Suffix %s') . '</span>', '<a href="' . $link . '"  target="_blank">' . __("link") . '</a>');
    }
    return $html;
}

內(nèi)聯(lián) CSS 樣式規(guī)則(可以添加到主題的 style.ccs 文件中):

Inline CSS style rules (can be added instead to the theme's styles.ccs file):

add_action('wp_head', 'product_price_suffix_css_styling_rules', 9999 );
function product_price_suffix_css_styling_rules() {
    // Only on single product pages
    if( is_product() ):
    ?><style>
        span.price-suffix {font-size: 13px; color: #000000;}
        span.price-suffix > a, span.price-suffix > a:visited {color: #DC143C}
        span.price-suffix > a:hover, span.price-suffix > a:active {color: #960404}
    </style><?php
    endif;
}

代碼位于活動子主題(或活動主題)的 functions.php 文件中.經(jīng)測試有效.

Code goes in functions.php file of your active child theme (or active theme). Tested and works.

這篇關(guān)于僅在所有 WooCommerce 單一產(chǎn)品上顯示價格后綴的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作為類名,因為它是保留的 Cake 2.2.x)
Session is lost after an OAuth redirect(OAuth 重定向后會話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
CakePHP Shared core for multiple apps(CakePHP 多個應(yīng)用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯誤:允許的內(nèi)存大小為 134217728 字節(jié)已用盡(嘗試分配 87 字節(jié)))
主站蜘蛛池模板: 波多野结衣一区二区三区在线观看 | 日韩电影一区 | 人人看人人爽 | 亚洲人精品 | 日本韩国电影免费观看 | 午夜精品一区 | 欧美亚洲国产一区 | 欧美一区二区三区一在线观看 | 欧美日韩视频在线第一区 | 一级做受毛片免费大片 | 亚洲国产aⅴ成人精品无吗 国产精品永久在线观看 | 久草免费在线视频 | 久草福利 | 久久1区| 精品国产一区二区三区免费 | 亚洲国产精品久久 | 国产羞羞视频在线观看 | 欧美日韩在线播放 | 日本爱爱视频 | 欧美日韩一区二区在线 | 91在线视频免费观看 | 中文字幕不卡在线观看 | 国内精品一区二区 | 日韩av在线中文字幕 | 国产三级在线观看播放 | 日本中文字幕日韩精品免费 | www狠狠干 | 在线亚洲一区二区 | 成人福利在线视频 | 亚洲激情在线观看 | 日韩中文一区 | 成年人在线观看视频 | 可以免费观看的av片 | 欧美91 | 国产日韩一区二区 | 一区二区在线免费观看 | 日本不卡在线观看 | 欧美一区二区免费电影 | 国内自拍视频在线观看 | 性做久久久久久免费观看欧美 | 91精品入口蜜桃 |