最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to change date language without changing the entire site language?

programmeradmin2浏览0评论

I want my entire site in English, but the dates to be in another language.

I tried to set PHP local like this:

setlocale(LC_ALL, 'he');

Setting my whole website to another language from the admin panel does change the time language, but I don't want this. Any ideas on how to accomplish that?

I want my entire site in English, but the dates to be in another language.

I tried to set PHP local like this:

setlocale(LC_ALL, 'he');

Setting my whole website to another language from the admin panel does change the time language, but I don't want this. Any ideas on how to accomplish that?

Share Improve this question edited Feb 21, 2022 at 13:04 Daniel Iliaguev asked Jun 8, 2018 at 1:07 Daniel IliaguevDaniel Iliaguev 311 silver badge3 bronze badges 3
  • Where do you want to time to display in the new language? Only on the front-end, or in all admin screens as well? – Slam Commented Jun 8, 2018 at 7:04
  • Only in the front end of the site, Still didn't found the write way. Of course I can search for the English words and replace them with my lang manually but that is not optimal. – Daniel Iliaguev Commented Jun 8, 2018 at 16:24
  • Don't forget about date_i18n developer.wordpress.org/reference/functions/date_i18n – rzepak Commented Jan 26, 2020 at 11:53
Add a comment  | 

2 Answers 2

Reset to default 1

It sounds like you want to create a multilingual site; even if you aren't displaying multiple languages on the admin side, it sounds like you want one language in the backend and another on the frontend.

You might want to check out WPBeginner's article on multi-language WordPress.

If all you are changing is the date language, and you are comfortable editing template, then you can alter the date displays alone using PHP.

You can change the global site language under Settings > General, but then edit your user account to set the admin language to whatever you want for your user account. For more info reference https://wptavern.com/wordpress-4-7-to-introduce-user-specific-language-setting-for-the-admin

发布评论

评论列表(0)

  1. 暂无评论