I am creating translation for a custom theme and specifically custom template file of the theme and user Poedit to create the pot template.

After translating the file one line in the template won't translate no matter what I do.

<?php echo __( 'Featured', 'mytextdomain' ); ?>

Possibly helpful additional info:

  1. this line isn't located within wordpress loop.
  2. If I remove echo part and leave only __() it wont even output word "Featured" in English
  3. I substitute echo__() with _e() "Featured" outputs.

Similar issue also custom "read more" form functions.php isn't translated.

function new_excerpt_more($more) { global $post; return ' &hellip;' . __('<a class="more-link" href="'. get_permalink($post->ID) . '">Read More</a>'); }

There's got to be something I'm doing wrong here since everything else translates and outputs except these two instances.

any ideas what am I doing wrong?

1 Answer 1


Your first line of code looks ok, are you sure you have a translation for the 'Featured' string in your PO file? Your second issue is an excellent example of how you should not use the gettext functions. You are trying to translate dynamic string '<a class="more-link" href="'. get_permalink($post->ID) . '">Read More</a>' for which you should have the corresponding translation for every different get_permalink($post->ID) value. What you should do instead is

return ' &hellip;<a class="more-link" href="'. get_permalink( $post->ID ) . '">' . __( 'Read More', 'mytextdomain' ) . '</a>';


return sprintf( ' &hellip;<a class="more-link" href="%s">%s</a>', get_permalink( $post->ID ), __( 'Read More', 'mytextdomain' ) );

and translate only the 'Read More' phrase.

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.