Force WordPress to use Italian date

To get date with get_the_time in Italian you should specify italian (it_IT) in the WP_LANG constamt in your wp_config.php file.…

November 21, 2014

To get date with get_the_time in Italian you should specify italian (it_IT) in the WP_LANG constamt in your wp_config.php file. If this doesn’t work (or if this affects your blog showing dates in italian where you don’t want them), there is always the fast DIRTY way. Put this function in your functions.php file and use where you need:

WordPress Date Italian

function getDataIta() {
	$s = strtolower( get_the_time( "j F Y" ) );
	$s = str_replace("july","luglio",$s);
	$s = str_replace("august","agosto",$s);
	$s = str_replace("september","settembre",$s);
	$s = str_replace("october","ottobre",$s);
	$s = str_replace("november","novembre",$s);
	$s = str_replace("december","dicembre",$s);
	$s = str_replace("january","gennaio",$s);
	$s = str_replace("february","febbraio",$s);
	$s = str_replace("march","march",$s);
	$s = str_replace("april","aprile",$s);
	$s = str_replace("may","maggio",$s);
	$s = str_replace("june","giugno",$s);
	return $s;
}

Author

I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.

Recommended

How to add rel=”nofollow” to links with preg_replace()

Adding rel="nofollow" to external link is a good SEO practice.

September 22, 2015

Social buttons: the fastest way for WordPress, without plugins

NOTE: the code in this post is written for WordPress but you can easily translate it in any language. You’re here…

September 15, 2015

Optimize WordPress, a long list of tips

In the above image you can see your WordPress before reading this post, and after the optimizations you will make…

Limit the number of categories for posts in WordPress

CHOOSE ONLY ONE CATEGORY WORDPRESS If you need to limit the number of categories used by the authors of your…

September 14, 2015

Remove archive pages in WordPress, how to

I think that in most blogs (that is not all) archive pages are redundant content and there’s no need to…

September 8, 2015

WordPress anyone can register, but no email confirmation

Many times it has happened to me that my WordPress installation properly send emails using wp_mail directly, specifing also the…

August 25, 2015