Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use custom metabox with date (day, month and year). The problem is when I try to transform date number to date word - for example 10 to be October. I use this code:

function eventposttype_get_the_month_abbr($month) {
global $wp_locale;
for ( $i = 1; $i < 13; $i = $i +1 ) {
            if ( $i == $month )
                $monthabbr = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
            }
return $monthabbr;
}

But now the month is displayed only with three symbols - Oct. I like to be full month name. Is there any way to define it?

Thank you in advance!

share|improve this question
    
Wherever you're calling your eventposttype_get_the_month_abbr function, e.g., $month_string = eventposttype_get_the_month_abbr($month), couldn't you instead use: $month_string = $wp_locale->get_month($month) (using @manny's answer below) –  akTed Jan 28 '13 at 6:18

1 Answer 1

up vote 4 down vote accepted

The code you are using is specifically for the month abbreviation, (Oct). You should be using this:

function eventposttype_get_the_month($month) {
global $wp_locale;
for ( $i = 1; $i < 13; $i = $i +1 ) {
            if ( $i == $month )
                $month =$wp_locale->get_month( $i ) ;
            }
return $monthabbr;
}
share|improve this answer
    
Kool! Didn't even know that the locals object contains such methods. +1 –  kaiser Jan 28 '13 at 4:13
1  
@kaiser I didn't either. Google pwns all :p –  Manny Fleurmond Jan 28 '13 at 12:23
    
Psst! Don't tell! ;) –  kaiser Jan 28 '13 at 13:16
    
Thank you for the fast answer :) –  Dido Kotsev Jan 28 '13 at 13:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.