当您将鼠标悬停在购物车图标上时,它会显示“查看您的购物车”。我的客户希望这个标题说“查看你的购物篮”。如何更改WooCommerce迷你购物车标题Atrribute
我已经找遍了模板文件没有运气,似乎无法找到任何function.php代码片段做这项工作。
我得到的最接近是找到“店面,woocommerce-模板的functions.php”文件,下面的代码:
function storefront_cart_link() {
?>
<a class="cart-contents" href="<?php echo esc_url(WC()->cart->get_cart_url()); ?>" title="<?php esc_attr_e('View your shopping cart', 'storefront'); ?>">
<span class="amount"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span> <span class="count"><?php echo wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront'), WC()->cart->get_cart_contents_count()));?></span>
</a>
<?php
}
但是没有我在这里做了网站上的任何影响。
解决:
add_filter('gettext', 'translate_reply');
add_filter('ngettext', 'translate_reply');
function translate_reply($translated)
{
$translated = str_ireplace('Shipping', 'Delivery', $translated);
$translated = str_ireplace('View your shopping cart', 'View your shopping basket', $translated);
return $translated;
}
这是你想要做什么http://stackoverflow.com/questions/18481472/change-the-text-of-view-cart-button? –