自定义 WooCommerce 简短描述 Metabox 标题 [英] Customizing WooCommerce Short Description Metabox title

查看:33
本文介绍了自定义 WooCommerce 简短描述 Metabox 标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以通过告诉我如何在 Wordpress 中自定义/更改文本标签来指导我 - 我最近在我的 wordpress 上安装了 WooCommerce,并且需要将添加产品"页面上的标签产品简短描述"更改为其他内容.有没有办法做到这一点?请参阅此图片以供参考:

Can someone guide me by telling me how I can customize/change Text label in Wordpress - I recently installed WooCommerce on my wordpress, and need to change the label "Product Short Description" on the "Add Product" page to something else. Is there a way to getting this done? Please see this image for reference:

推荐答案

回答您的问题: 是的,有一个工作过滤器钩子可以通过国际化函数(__(),_e() 等)

To answer to your question: YES there is a working filter hook that can translate text by the internationalization functions (__(), _e(), etc.)

代码如下:

add_filter( 'gettext', 'theme_domain_change_excerpt_label', 10, 2 );
function theme_domain_change_excerpt_label( $translation, $original )
{
    if ( 'Product Short Description' == $original ) {
        return 'My Product label';
    }
    return $translation;
}

此代码位于活动子主题(或主题)的 function.php 文件或任何插件文件中.

代码已经过测试并且功能齐全.<小时>参考资料:

The code is tested and fully functional.


References:

这篇关于自定义 WooCommerce 简短描述 Metabox 标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆