admin管理员组文章数量:1293747
I have theme with this code in one php file :
'logged_in_as' => '<p class="logged-in-as">'.
sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'testshop' ),
admin_url( 'profile.php' ),
$user_identity,
wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ).
'</p>',
Now I want to change this code and unlocalized and only one text.
I change this to code below , but not work and get the error
Parse error: syntax error, unexpected 'echo' (T_ECHO)
'logged_in_as' => '<p class="logged-in-as">'.
echo ( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'),
admin_url( 'profile.php' ),
$user_identity,
wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ).
'</p>',
please help me to fix this. thanks
I have theme with this code in one php file :
'logged_in_as' => '<p class="logged-in-as">'.
sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'testshop' ),
admin_url( 'profile.php' ),
$user_identity,
wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ).
'</p>',
Now I want to change this code and unlocalized and only one text.
I change this to code below , but not work and get the error
Parse error: syntax error, unexpected 'echo' (T_ECHO)
'logged_in_as' => '<p class="logged-in-as">'.
echo ( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'),
admin_url( 'profile.php' ),
$user_identity,
wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ).
'</p>',
please help me to fix this. thanks
Share Improve this question edited Apr 29, 2021 at 8:02 bueltge 17.1k7 gold badges62 silver badges97 bronze badges asked Apr 28, 2021 at 13:26 masoud nkhmasoud nkh 886 bronze badges1 Answer
Reset to default 1The main problem is that you removed the sprintf.
Replace the echo with sprintf and remove the ().
Should be like this
'logged_in_as' => '<p class="logged-in-as">'.
sprintf( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>',
admin_url( 'profile.php' ),
$user_identity,
wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ).
'</p>',
Be careful! changing code directly in a plugin will lead to problems.
Next plugin update your code will be removed so be mindful.
If you can try using a filter, if the plugin has one. That way the changed you are doing when connecting to that filter will stay, unless the plugin author changed the filter name =]
本文标签: translationhow to unlocalize themeplugin
版权声明:本文标题:translation - how to unlocalize themeplugin? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741587220a2386914.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论