我需要将两个单词更改为WordPress主题中的阿拉伯语

发布于 2025-02-02 17:06:13 字数 592 浏览 4 评论 0原文

我需要将“上次更新”和“发布”从下面的代码更改为阿拉伯语的另一个单词。

该代码是“ template-tags.php”文件的一部分,它是WordPress主题文件的一部分,

我刚刚尝试替换单词,但对我不起作用,

它看起来像是这样。 ��”

<?php if ( get_theme_mod('show_post_date', '1') == 1 ) : ?>
<div class="entry-date"><i class="fa fa-clock-o"></i><span >
 
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 60) {

echo "Last updated on ";       // here

the_modified_time('Y-m-d');
}
else {echo "Posted on ";       // here

the_time('Y-m-d');
} ?>

I need to change "Last updated on" and "Posted on" From the code below to another words in arabic.

This code is part of the "template-tags.php" file which is part of the WordPress theme files

I just tried replacing the words but it didn't work for me

It just looks like this"����������"

<?php if ( get_theme_mod('show_post_date', '1') == 1 ) : ?>
<div class="entry-date"><i class="fa fa-clock-o"></i><span >
 
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 60) {

echo "Last updated on ";       // here

the_modified_time('Y-m-d');
}
else {echo "Posted on ";       // here

the_time('Y-m-d');
} ?>

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

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

发布评论

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

评论(1

如梦 2025-02-09 17:06:13

代码似乎没有问题。您可以应用这些更改以查看它是否有效。

使用htmlentities

<?php if (get_theme_mod('show_post_date', '1') == 1) : ?>
    <div class="entry-date"><i class="fa fa-clock-o"></i><span>

    <?php $u_time = get_the_time('U');
    $u_modified_time = get_the_modified_time('U');
    if ($u_modified_time >= $u_time + 60) {

        $text = 'آخر تحديث في';

        echo htmlentities($text, ENT_QUOTES, "UTF-8");       // here

        the_modified_time('Y-m-d');
    } else {

        $text = 'نشر على';
        echo htmlentities($text, ENT_QUOTES, "UTF-8");       // here

        the_time('Y-m-d');
    } ?>

<?php
endif;

请注意,我

<? Php
endif;

添加了自己,它可能与您的代码有所不同,并且仍然继续。

或者,您可以使用utf8_encode这样:

<?php if (get_theme_mod('show_post_date', '1') == 1) : ?>
    <div class="entry-date"><i class="fa fa-clock-o"></i><span>

    <?php $u_time = get_the_time('U');
    $u_modified_time = get_the_modified_time('U');
    if ($u_modified_time >= $u_time + 60) {

        $text = 'آخر تحديث في';

        echo utf8_encode($text);       // here

        the_modified_time('Y-m-d');
    } else {

        $text = 'نشر على';
        echo utf8_encode($text);       // here

        the_time('Y-m-d');
    } ?>

<?php
endif;

如果以上不起作用。
您应该检查页面上是否有utf-8元。 &lt; meta charset =“ utf-8”&gt;此元应在您的header.php文件中。如果没有,请添加。
如果您完成了所有工作但没有回答,请使用标准的阿拉伯语或波斯字体

There seems to be no problem with the code. You can apply these changes to see if it works.

Using htmlentities

<?php if (get_theme_mod('show_post_date', '1') == 1) : ?>
    <div class="entry-date"><i class="fa fa-clock-o"></i><span>

    <?php $u_time = get_the_time('U');
    $u_modified_time = get_the_modified_time('U');
    if ($u_modified_time >= $u_time + 60) {

        $text = 'آخر تحديث في';

        echo htmlentities($text, ENT_QUOTES, "UTF-8");       // here

        the_modified_time('Y-m-d');
    } else {

        $text = 'نشر على';
        echo htmlentities($text, ENT_QUOTES, "UTF-8");       // here

        the_time('Y-m-d');
    } ?>

<?php
endif;

Notice that I

<? Php
endif;

I added myself, it will probably be different from your code and still continue.

Or you can use utf8_encode like this:

<?php if (get_theme_mod('show_post_date', '1') == 1) : ?>
    <div class="entry-date"><i class="fa fa-clock-o"></i><span>

    <?php $u_time = get_the_time('U');
    $u_modified_time = get_the_modified_time('U');
    if ($u_modified_time >= $u_time + 60) {

        $text = 'آخر تحديث في';

        echo utf8_encode($text);       // here

        the_modified_time('Y-m-d');
    } else {

        $text = 'نشر على';
        echo utf8_encode($text);       // here

        the_time('Y-m-d');
    } ?>

<?php
endif;

And if the above did not work.
You should check to see if there is a UTF-8 meta on your page. <meta charset="utf-8"> This meta should be in your header.php file. If not, add it.
If you did all the work but did not answer, use a standard Arabic or Persian font

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