0

On the menus admin page, it says 'Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.'

I would like to modify this to ' Drag each item into the order you prefer. The maximum top level pages is 6'.

How can I do this? Thanks. I have been trying to figure it out but have got no where.

1

The text you are referring to is located in here: wp-admin/nav-menus.php. But we will not edit directly. We will use functions.php for the convenience of preserving the changes after an upgrade.

Use the following code in functions.php

add_filter(  'gettext',  'wps_translate_words_array'  );
add_filter(  'ngettext',  'wps_translate_words_array'  );
function wps_translate_words_array( $translated ) {

 $words = array(
                    // 'word to translate' = > 'translation'
                    'Click the arrow on the right of the item to reveal additional configuration options.' => 'The maximum top level pages is 6',
                );

 $translated = str_ireplace(  array_keys($words),  $words,  $translated );
 return $translated;
}
  • Thank-you that worked. How did you know to use gettext,ngettext and $words ? I'm new to wordpress development and would really appreciate if you told me. – Leona grey Apr 28 '15 at 13:24
  • Mostly you can search in Codex. But this is an excellent website to get snippets. WPSnipp Just needed to edit the string and tested in my dev server admin panel. Good Luck! :) – Manoj Kumar Apr 28 '15 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.