我正在尝试从后端更改:
外观->标题
到
外观->徽标
但是Changing Admin Menu Labels 到目前为止,答案没有帮助。
有新的提示吗?
谢谢
你可以用gettext
按以下方式过滤。
function rename_header_to_logo( $translated, $original, $domain ) {
$strings = array(
\'Header\' => \'Logo\',
\'Custom Header\' => \'Custom Logo\',
\'You can upload a custom header image to be shown at the top of your site instead of the default one. On the next screen you will be able to crop the image.\' => \'You can upload a custom logo to be shown at the top of your site instead of the default one. On the next screen you will be able to crop the image.\'
);
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 );
您可能需要检查文本是否与其他地方的另一个“标题”文本冲突。当没有可用的钩子时,jQuery它。。。
add_action( \'admin_footer\', \'wpse_46677_change_menu_item\' );
function wpse_46677_change_menu_item()
{
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
$("#menu-appearance").find("li:contains(\'Header\')").html(\'<a href="themes.php?page=custom-header">My Text</a\');
});
</script>
<?php
}
对于我当前的主题(自定义),默认菜单选项在wp admin中被禁用,请帮助我启用它。下图显示了问题。提前谢谢。