WordPress if (is_page) translation on certain page

Question

Hy there i have the following code for custom translations there are missing.

function translate_text( $translated ) {
$translated = str_ireplace( 'All Ratings',  'Alle Bewertug',  $translated );
$translated = str_ireplace( 'No Ratings',  'keine Bewertug',  $translated );
$translated = str_ireplace( 'Ratings',  'Bewertug',  $translated );
  return $translated;
}

add_filter( 'gettext',  'translate_text' );
add_filter( 'ngettext',  'translate_text' );

it works fine, but on every WordPress Pages. I would like this code to only be used on certain pages…
Page name is “wprecipemaker”
For example: wp-admin/admin.php?page=wprecipemaker#/

I try a lot with if (is_page) but unfortunately without success. Does anyone have any ideas? That would help me a lot.

0
, , , Reto Schneebeli 4 years 2020-03-30T12:51:15-05:00 0 Answers 86 views 0

Leave an answer

Browse
Browse