跳过导航

本主题包含 0 則回覆 ,有 0 声音 。

最后由 aigarsM 1 weeks, 5 days前 更新。

协助者:: Shekhar Bhandari.

作者 文章
25 2 月, 2025 于 7:48 上午

aigarsM

Background of the issue:
I am trying to output the name of the month using the wp_date function. I used the following code:

$timezone = wp_timezone();
$post_date = strtotime ( get_the_date( 'Y-m-d', $post_id ) );
$custom_date_day = wp_date( 'j.', $post_date, $timezone );
$custom_date_month = wp_date( 'F. Y', $post_date, $timezone );

Link to a page where the issue can be seen: 隐藏链接

Symptoms:
I expected to see the name of the month in the current language, but instead, wp_date outputs it in English.
I also checked and saw that global $wp_locale is in English (the main language is Latvian).

Questions:
How can I make wp_date output the month name in the current language instead of English?

25 2 月, 2025 于 8:15 上午