I am trying to make my theme translatable so I am using the following command to output text. But its just returning an empty value some reason? No error is displayed

<?php __('PLAYER POINTS AT A GLANCE.','gogreensoccer');?>
<div class="skill-title">
            <h3><?php __('PLAYER POINTS AT A GLANCE.','gogreensoccer');?></h3>
        <div class="col-md-5 col-sm-12">
            <div class="kids-dashboard-skill">
                <div class="skill-show">
                    <div class="points"><h3><span><?php  echo $player->display( 'points' ); ?></span>POINTS</h3></div>
                    <div class="circle-skill"><div id="circle" data-size="<?php  echo $player->display( 'points' ); ?>" data-thickness="35"></div></div>
                <div class="skill-button">
                        <button><?php __('VIEW MY TEAM MATES.','gogreensoccer');?></button>
                        <button><?php __('Player ID','gogreensoccer');?><?php echo $playerId;?></button>

But I'm not getting any text outputed obv I want a default value here if no translation exists I though __(string,themename) would achieve this.

  • 1
    __() returns a string, that is why you see nothing, _e() echos the string, this is what you want Oct 26, 2015 at 12:45
  • @PieterGoosen thanks can u put up an answer so can mark as complete mate is _e wpm comptable as well is this all i have do to allow users to translate if they install a plugin to do so Oct 26, 2015 at 12:49

2 Answers 2


The localizing functions have two variaties, one that echos the string value and the other one that returns it's string value.

Because you would want to display the string (echo it), you would want the correct function for the specific string which will echo the output. For easy simple strings (__('PLAYER POINTS AT A GLANCE.','gogreensoccer')) like you have above, the __() and _e() functions would work

  • __('PLAYER POINTS AT A GLANCE.','gogreensoccer') would return the string value, useful if you need add a value to a variable and store for later use

  • _e('PLAYER POINTS AT A GLANCE.','gogreensoccer') would be what you need. This will echo the string to screen

Both are valid in all plugins and themes

  • Of note, esc_html_e would be a more secure option here if you're sure that no HTML will be in the translated string ( escaping! )
    – Tom J Nowell
    Oct 26, 2015 at 14:16
  • @TomJNowell esc_html_e() will defintely be better than the unescaped _e(). Just my point of view, you should not be translating HTML in the first place, so you should never have HTML in any string to be translated. HTML should be replaced by placeholders and then you should be using sprintf and printf ;-) Oct 26, 2015 at 14:23
  • I agree, it's important to be aware of all the options to prevent double escaping
    – Tom J Nowell
    Oct 26, 2015 at 14:27

Use your theme name.

if your theme name is "gogreensoccer" then this code is fine else use your theme name at the place of "gogreensoccer" then this will work.After that generate wpml theme translation option to generate your theme strings.

  • was not the issues please donnt try and just guess when just new Oct 26, 2015 at 13:07

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.