WordPress: адекватный вывод даты на кириллице. Чтобы дата...
WordPress: адекватный вывод даты на кириллице. Чтобы дата выводилась в нормальном виде, вставьте этот код в functions.php:
function true_russian_date_forms($the_date = '') {
if ( substr_count($the_date , '---') > 0 ) {
return str_replace('---', '', $the_date);
}
$replacements = array(
"Январь" => "января",
"Февраль" => "февраля",
"Март" => "марта",
"Апрель" => "апреля",
"Май" => "мая",
"Июнь" => "июня",
"Июль" => "июля",
"Август" => "августа",
"Сентябрь" => "сентября",
"Октябрь" => "октября",
"Ноябрь" => "ноября",
"Декабрь" => "декабря"
);
return strtr($the_date, $replacements);
}
add_filter('the_time', 'true_russian_date_forms');
add_filter('get_the_time', 'true_russian_date_forms');
add_filter('the_date', 'true_russian_date_forms');
add_filter('get_the_date', 'true_russian_date_forms');
add_filter('the_modified_time', 'true_russian_date_forms');
add_filter('get_the_modified_date', 'true_russian_date_forms');
add_filter('get_post_time', 'true_russian_date_forms');
add_filter('get_comment_date', 'true_russian_date_forms');
P.S.: Протестировал код на своем сайте, полет нормальный.
#полезное #wordpress via @seospecialist
Ссылки из поста:– https://telegra.ph/file/fd8c5f80697efbd8f576e.jpg
Источник новости https://t.me/seospecialist/396...