Перейти к содержимому Перейти к боковой панели

Эта тема содержит 0 ответ, имеет 0 voices.

Последнее обновление: aigarsM 11 месяцев, 1 неделя назад.

При содействии: Shekhar Bhandari.

Автор Сообщения
25 февраля, 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?