Thank for reading my issue.
Please help that which code snippets can let me change the text "customer reviews" in html below:
<a href="#reviews" class="woocommerce-review-link" rel="nofollow"><span class="count">1</span> customer reviews</a>
I had try this but it not work for me.
add_filter( 'gettext', function( $translated_text ) {
if ( '**customer reviews**' === $translated_text ) {
$translated_text = '**reviews**';
}
return $translated_text;
} );
Thank you!
2
Answers
This is a little complex so I’ll try to use plain English where possible. If you do a search through the WooCommerce plugin for the string you need, you’ll find this:
…which means you can’t use the gettext filter, you need the ngettext one instead as this is a more complex internationalization function:
In WordPress for changing any text showing on front end or on admin you can change with
add_filter('gettext', '_translateTextCustom', 100, 3 );
Try below code snippet
global $pagenow
– You will access all php pages with this global variable.global $post_type
– You will access all post types which you want conditionally.