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.

what WordPress core functions do I have to modify to change

comments_popup_link('Ni komentarjev', '1 komentar','% komentarjev') 

to

comments_popup_link('Ni komentarjev', '1 komentar', **'2 komentarja',** '% komentarjev')

I'd like to add an argument for 2 comments. And what lines to add to this functions?

The reason why would I want to do that is simply the fact that in my home language we start plural by 3. I want it to be spelled correctly.

share|improve this question
1  
You can't - you'll have to make a duplicate of that function and add that functionality –  onetrickpony Oct 17 '11 at 19:34
    
Yes, but which function to duplicate and how to add that functionality. I was searching across the net and according to CatsWhoCode website, to replace core function you use filters –  jesiher Oct 17 '11 at 20:21
    
This is located in your theme's files, so simply alter them (in a child theme possibly), the only filter that is available inside comments_popup_link() is comments_popup_link_attributes which is not quite useful in your case; where is that line of yours located again? –  soulseekah Oct 18 '11 at 5:53

1 Answer 1

Filter 'comments_number'. You get the translated number and the real number as arguments. Return what fits best.

Sample code:

add_filter( 'comments_number', 'wpse_31328_comments_number_i18n', 10, 2 );

function wpse_31328_comments_number_i18n( $text, $number )
{
    if ( 2 === $number )
    {
        return _x( '2 comments', 'comments number', 'your_text_domain' );
        // or hard coded:
        // return '2 komentarja';
    }

    return $text
}
share|improve this answer

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.