Customize month names in WordPress

Customize month names in WordPress

In shape of function, you can use this code in functions.php:

function wpog_custom_date($date){
    $new_date = getdate(strtotime($date));
    // Array that holds customized month’s name
    $my_months=[
            ‘January’   => ‘januar’,
            ‘February’  => ‘februar’,
            ‘March’     => ‘mart’,
            ‘April’     => ‘april’,
            ‘May’       => ‘maj’,
            ‘June’      => ‘jun’,
            ‘July’      => ‘jul’,
            ‘August’    => ‘avgust’,
            ‘September’ => ‘septembar’,
            ‘October’   => ‘oktobar’,
            ‘November’  => ‘novembar’,
            ‘December’  => ‘decembar’,
        ];
        $new_date[‘month’]= $my_months[$new_date[‘month’]];
return $new_date[‘mday’].’. ‘.$new_date[‘month’]. ‘ ‘. $new_date[‘year’].’.’;
    }
If you want to make it global over full website, use this filter in functions.php:
function wpog_change_translate_text_multiple( $translated ) {
$text = array(
‘January’ => ‘Jan11’,
‘February’ => ‘Feb22’,
‘March’ => ‘Mar33’,
);
$translated = str_ireplace( array_keys($text), $text, $translated );
return $translated;
}
add_filter( ‘gettext’, ‘wpog_change_translate_text_multiple’, 20 );
Twitter
Facebook
LinkedIn
Telegram
WhatsApp
Email