个性化阅读
专注于IT技术分析

显示英文字符而不是阿拉伯语

我在网站上发布了圣训, 并以3种译文发布了它:阿拉伯语, 乌尔都语, 英语。在圣训的页面上, 圣训正在逐一显示, 它显示的是阿拉伯文摘录文本。

查看我的网站, 这是我的网站链接:IF Islam

看这个截图:

在此处输入图片说明

我想在这里显示英文的圣训摘录文本, 而不是阿拉伯语和乌尔都语。

哪个PHP代码将执行此操作?

请帮忙

这是content.php代码:

<div class="col-lg-8 col-md-6">
    <div class="card-body">
       <a href="<?php the_permalink(); ?>" class="">
           <h2 class="single_post_title h3-responsive text-primary mb-1"><?php the_title(); ?></h2>
       </a>
       <div class="blog_meta">
           <time class="blog_meta_posted_on grey-text"><?php the_time('F j, Y g:i a'); ?></time>
           <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" class="blog_meta_author grey-text"><?php the_author(); ?></a>
           <a href="<?php the_permalink(); ?>#responses" class="blog_meta_count_comments grey-text"><?php echo get_comments_number(); ?> Comments</a>
           <label class="blog_meta_tags_list">
                <?php echo get_the_tag_list( '', ', ', '' ); ?>
           </label>
       </div>
       <div class="blog_excerpt_content black-text m-0 mt-2">
           <?php the_excerpt(); ?>
       </div>
       <a href="<?php the_permalink(); ?>" class="btn btn-primary">Read More</a>
    </div>
</div>

#1


尝试更换

<?php the_excerpt(); ?>

<?php
$position = strpos(get_the_content(), 'Hadith in English Translation');
$excerpt = strip_tags(substr(get_the_content(), $position));
echo $excerpt;
?>

我认为get_the_content()返回HTML中的帖子完整内容。我们使用strpos和substr函数构造了一个新的$ excerpt, 从” Hadith in English Translation”开始到帖子内容的末尾。我们还使用strip_tags摘录了所有HTML标记的摘录。

当然, 你只需要为Hadith类别使用代码(在你添加的” category-hadith.php”内部?), 因为你只需要在那里进行修改。

检查它是否正常工作, 并注意该解决方案假定帖子内容始终带有字符串” Hadith in English Translation”, 并且英语翻译在其他两个之后排在最后。


#2


我认为我们需要更多信息才能正确回答你的问题。对于初学者来说, 你能否向我们展示用于显示摘录的代码。根据你的问题, 我只能想象你在CMS摘录中按字面意思输入的阿拉伯文字。

赞(0)
未经允许不得转载:srcmini » 显示英文字符而不是阿拉伯语

评论 抢沙发

评论前必须登录!