im trying to translate twenty ten based child theme, I have modifided the single-loop.php with a custom snippet, that shows next and previous arrows...

my issue is that this string (next and previous text) cant be translated... the replacement doesnt occur with this specific string. I do all the process of detecting the string and creating all with poedit, but does not work. all other strings do translate OK.

I edited the php file single-loop.php:

<?php add_filter('wp_get_object_terms', 'my_custom_post_navigation', 4, 99); ?>
<div id="nav-above" class="navigation">
    <div class="nav-previous">
        <?php next_post_link( '<span class="meta-nav"> %link </span>', __( '&#9668; Previous','Previous post link', 'category','twentyten') , TRUE ); ?>
    <div class="nav-next">
        <?php previous_post_link( '<span class="meta-nav"> %link </span>', __( 'Next &#9658;','Next post link', 'category', 'twentyten') , TRUE ); ?>
</div><!-- #nav-above -->
<?php remove_filter('wp_get_object_terms', 'my_custom_post_navigation', 99); ?>

<!-- END .featandnav  of Featured and Navigation container DIV  -->

-Then I scanned all the php files with poedit and the strings appear: I translated them (Next ► - and -◄ Previous) using poedit..

but then, even that I uploaded the files to the theme language folder, this string does not translate, as I mentioned before: all the others original of the theme, do translate...

What I'm doing wrong?

Thanks for your help.

  • 2
    Why are there four arguments in the translation string? AFAIK; there should only be the translatable string, and the text domain as arguments __('Next', 'twentyten') or __('Previous', 'twentyten').
    – josh
    May 20, 2015 at 12:42

1 Answer 1


Take a closer look at next_post_link and previous_post_link. Specifically; how the function arguments are arranged.

Next, take a closer look at translating strings; and how the function arguments are arranged.

Now, when you put the two together; you should have something like this:

<?php previous_post_link( '<span class="meta-nav"> %link </span>', __( '&#9668; Previous','twentyten'), TRUE ); ?>


<?php next_post_link( '<span class="meta-nav"> %link </span>', __( 'Next &#9658;', 'twentyten'), TRUE ); ?>

The first argument of next_post_link and previous_post_link is the html structure to display; the second argument is the string of text to use; the third argument is used to determine if you are staying within the same taxonomy when going back and forth.

Regarding the __() translation function; the first argument is the text string to be translated; and the second argument is the text domain (although this can vary depending on which localization function is being used).

  • Great :) Always happy to help!!
    – josh
    May 20, 2015 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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