如何重命名插件标题 >WordPress >仪表盘 [英] How rename a plugin title > Wordpress > Dashboard

查看:26
本文介绍了如何重命名插件标题 >WordPress >仪表盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问,有人可以帮我吗?我需要更改安装在我的 wordpress 中的插件的名称(只有管理栏中的名称可以;).谢谢!

Please, may someone help me? I need change the name of a plugin installed in my wordpress (Only the name in the admin bar is fine ;) . Thanks!

预览:

推荐答案

这是更改标签的过程(在我的示例中,我将 WooCommerce 更改为Stall").您可以通过以下方式使用 gettext filter 尝试.

Here's the process to change the labels (I changed WooCommerce to "Stall" in my example). You could try that with the gettext filter in the following manner.

在您的 functions.php 文件中使用它

Use this in your functions.php file

function rename_header_to_logo( $translated, $original, $domain ) {

$strings = array(
    'WooCommerce' => 'Stall',
    'Custom Header' => 'Custom Stall'
);

if ( isset( $strings[$original] ) && is_admin() ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
}

  return $translated;
}

add_filter( 'gettext', 'rename_header_to_logo', 10, 3 );

您也可以申请以下代码

function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
    case 'WooCommerce' :
        $translated_text = __( 'Stall', 'woocommerce' );
        break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );

这篇关于如何重命名插件标题 >WordPress >仪表盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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