Change "Leave Comment" to something else
-
Hi, I went through the read the previous responses, but it’s not doing what I want. Say you visit a website and see a post. At the bottom of the post, there it says “Leave Comment” (and this is BEFORE you click read more to see full article.)
How do I change Leave Comment & later X number of comments to some other words?
Like to “Leave a smiley” & “4 smileys” for examples.
You could add this code in your child-theme functions.php file:
function graphene_filter_gettext( $translated, $original, $domain ) {
$strings = array(
'Leave comment' => 'Leave a :)',
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 ); ?>Thanks Luko! You’re amazing for the speedy help.
One more question, how would I change the number of comments already exist? 4 comments to 4 somethingelse?
I’m not familiar with I18N functions for translations so I can’t help you through with it.
Although you can do this:
function graphene_filter_gettext( $translated, $original, $domain ) {
$strings = array(
'Leave comment' => 'Leave a :)',
'%s comment' => '1 of something else',
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );for any other number won’t work (plurals).
I tried with translation also (poedit) but with no results…
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.