Woocommerceサードパーティのプラグインからのテキストを変更します

アルダYilmazの:

私はWooCommerceウィッシュリストを使用して変更したいんだ追加の製品別のものにします。ここでの抜粋は以下のとおりです。

public static function add_to_wishlist_button( $url, $product_type, $exists ) {
    _deprecated_function( 'add_to_wishlist_button', '2.0.0', 'add-to-wishlist-button.php template' );
    global $yith_wcwl, $product;
    $product_id = yit_get_product_id( $product );
    $label_option = get_option( 'yith_wcwl_add_to_wishlist_text' );
    $localize_label = function_exists( 'icl_translate' ) ? icl_translate( 'Plugins', 'plugin_yit_wishlist_button', $label_option ) : $label_option;
    $label = apply_filters( 'yith_wcwl_button_label', $localize_label );
    $icon = get_option( 'yith_wcwl_add_to_wishlist_icon' ) != 'none' ? '<i class="fa ' . get_option( 'yith_wcwl_add_to_wishlist_icon' ) . '"></i>' : '';
    $classes = get_option( 'yith_wcwl_use_button' ) == 'yes' ? 'class="add_to_wishlist single_add_to_wishlist button alt"' : 'class="add_to_wishlist"';
    $html  = '<div class="yith-wcwl-add-to-wishlist">';
    $html .= '<div class="yith-wcwl-add-button';  // the class attribute is closed in the next row
    $html .= $exists ? ' hide" style="display:none;"' : ' show"';
    $html .= '><a href="' . esc_url( add_query_arg( 'add_to_wishlist', $product_id ) ) . '" data-product-id="' . $product_id . '" data-product-type="' . $product_type . '" ' . $classes . ' >' . $icon . $label . '</a>';
    $html .= '<img src="' . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . '" class="ajax-loading" alt="loading" width="16" height="16" style="visibility:hidden" />';
    $html .= '</div>';
    $html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;"><span class="feedback">' . __( 'Product added!','yith-woocommerce-wishlist' ) . '</span> <a href="' . esc_url( $url ) . '">' . apply_filters( 'yith-wcwl-browse-wishlist-label', __( 'Browse Wishlist', 'yith-woocommerce-wishlist' ) ) . '</a></div>';
    $html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ( $exists ? 'show' : 'hide' ) . '" style="display:' . ( $exists ? 'block' : 'none' ) . '"><span class="feedback">' . __( 'The product is already in the wishlist!', 'yith-woocommerce-wishlist' ) . '</span> <a href="' . esc_url( $url ) . '">' . apply_filters( 'yith-wcwl-browse-wishlist-label', __( 'Browse Wishlist', 'yith-woocommerce-wishlist' ) ) . '</a></div>';
    $html .= '<div style="clear:both"></div><div class="yith-wcwl-wishlistaddresponse"></div>';
    $html .= '</div>';
    $html .= '<div class="clear"></div>';
    return $html;
}

function.phpからそのテキストを変更するためのベストプラクティスは何ですか

lupoyucc:

文字列がすでに機能にラップされているので__($string, $domain)、簡単に任意のコードを使用したり、あなたのfunctions.phpを編集せずにそれを翻訳することができます。必要なのは、翻訳者プラグイン(私は翻訳ロコを使用することをお勧め)です。

  • プラグインをインストールします。
  • 設置行く後>「プラグイン」WPのダッシュボードの上に左の列のメニューを使用して「ロコ翻訳」
  • あなたはWooCommerce Whislistsを管理するために使用するものを選択し、現在のウェブサイトにインストールされているプラ​​グインの一覧が表示されます
  • (あなたが新しいものを作成している場合や言語設定を挿入)し、リストから言語を選択するか、あなたの言語が存在しない場合は、「新しい言語」をクリックしてください
  • 翻訳したい文字列を選択して、下のテキストエリアに翻訳を置きます
  • セーブ

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=20227&siteId=1