主题php文件中的Wordpress主题名称,这是什么目的? [英] Wordpress theme name inside theme php files, what is the purpose of this?

查看:30
本文介绍了主题php文件中的Wordpress主题名称,这是什么目的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

近一年来我一直在构建基本主题,我正在努力尽可能地清理我的风格.但我不知道去哪里寻找它的作用...

I've been building basic themes now for nearly a year, and I'm trying to clean up my style as much as possible. But I don't know where to look to find out what this does...

在 kubrick 主题的 php 文件中,例如你会得到一个这样的 php 标签...

In the kubrick theme php files, for example you get a php tag like this...

<?php the_content('<p class="serif">' . __('Read the rest of this entry &raquo;', 'kubrick') . '</p>'); ?>

您看到主题名称kubrick"编织在其中.这样做的目的是什么?

You see the theme name 'kubrick' weaved in. What is the purpose of this?

你会在所有主题中看到它,二十一、二十一等......但如果我保持不变,我永远不会注意到任何不同.如果我将其更改为我当前的主题名称,这有什么好处?

You see it in all themes, twentyten, twentyeleven, etc.. but I never notice a difference if I leave it the same. What benefits does this have if I change it to my current theme name?

谁能教教我?或者给我指明正确的方向?

Can anyone enlighten me? or point me in the right direction?

谢谢乔希

推荐答案

这是主题文本域",通常用于本地化.您可以通过阅读 gettext 过滤器参考了解更多信息.一个注意事项是文本域不需要与您的主题名称相同.只要与使用 load_theme_textdomain 加载的内容一致,就可以随心所欲.使其与您的主题名称相同只是惯例.最后,至于为什么你应该费心在此处包含域,引用自一篇名为 如何使用 GetText 本地化 WordPress 主题和插件:

This is the 'theme text domain' and is typically used for localization. You can find out more by reading the gettext filter reference. One note is that the text domain is not required to be the same as your theme name. You can make it whatever you want as long as you are consistent with what you load using load_theme_textdomain. It's just convention to make it the same as your theme name. Finally, as to why you should bother including a domain here is a quote from an article called How to localize WordPress themes and plugins with GetText:

您注意到 GetText 调用中的第二个参数了吗?这是一个可选参数,告诉 GetText 的范围(域)文本是.如果提供,此 GetText 将仅返回翻译从您随该域名提供的字典中.虽然可选,强烈建议指定翻译域.没有它,GetText 可能会返回不同的翻译,如果相同字符串也出现在不同的插件或 WordPress 中.

Have you noticed the 2nd argument in the GetText calls? It’s an optional argument that tells GetText what the scope (domain) of the texts is. If supplied, this GetText will return the translations only from the dictionary that you supply with that domain name. Although optional, specifying the translation domain is highly recommended. Without it, GetText might return a different translation, if the same string also appears in a different plugin, or in WordPress.

这篇关于主题php文件中的Wordpress主题名称,这是什么目的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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