Wordpress,更改 language_attributes 以返回 dir=rtl

发布于 2024-09-27 12:03:32 字数 323 浏览 0 评论 0原文

在 WordPress 中,主题的 header.php 文件内有下一行:

<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

默认情况下,it(language_attributes) 返回 dir=ltr,并且每个在线指南都read 试图展示一种挂起 css 文件的方法。

这还不够,而且不符合语义。我需要将 html 本身更改为 rtl。 怎么办呢? 有设置文件吗?

In wordpress, inside the header.php file of a theme, there is the next line:

<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

By default, it(language_attributes) returns dir=ltr, and every online guide i read tried to show a way to hange the css file.

it's not enough and not semantic. i need to change the html itself to rtl.
how can it be done?
is there a settings file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

女皇必胜 2024-10-04 12:03:32

您可以通过语言文件控制文本方向。例如,如果您下载阿拉伯语(RTL 语言)Wordpress
您会发现该值在 \wp-content\languages\ar.php 中设置为:

$text_direction = 'rtl';

要启用它..您需要将 wp-config 中的 WPLANG 变量设置为 RTL 语言,如下所示:

define ('WPLANG', 'ar');

然后您的 language_attributes () 会输出你想要的 dir='rtl' 。

You can control the text direction via the language files. If you download the Arabic(an RTL langauge) Wordpress for example.
You'll find this value is set in the \wp-content\languages\ar.php as:

$text_direction = 'rtl';

And to enable it..you need to set the WPLANG variable in your wp-config to the RTL language like this:

define ('WPLANG', 'ar');

Then your language_attributes() will output the dir='rtl' you want.

仲春光 2024-10-04 12:03:32

编辑默认语言的最佳方法是通过根目录中的 wp-config.php 文件。

此案例适用于西班牙的西班牙语
定义('WPLANG','es_ES');

这一篇去美国英语
定义('WPLANG','en_US');

您在此页面上拥有所有可能的组合:
http://xml.coverpages.org/iso639a.html

问候

The best way to edit your default language is through the wp-config.php file on the root directory.

This case should be for Spanish of Spain
define ('WPLANG', 'es_ES');

This one to the USA English
define ('WPLANG', 'en_US');

You have all the possible combinations at this page:
http://xml.coverpages.org/iso639a.html

Regards

爱她像谁 2024-10-04 12:03:32

看看下面两个链接。您需要确保您的主题和 WordPress 都设置为 RTL。

http://codex.wordpress.org/Right_to_Left_Language_Support

http://codex.wordpress.org/Function_Reference/get_bloginfo

Take a look at the following two links. You need to ensure both of your theme and WordPress are setup for RTL.

http://codex.wordpress.org/Right_to_Left_Language_Support

http://codex.wordpress.org/Function_Reference/get_bloginfo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文