load_textdomain won’t load my .mo file

I found the answer: load_textdomain( ‘site-map’, TEMPLATEPATH.’/partials/languages’ ); … gives the path of the folder containing the .mo file. but the path of every individual mo file should be used in its own load_textdomain instruction : load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-fr_FR.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-en_US.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-es_ES.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-ru_RU.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-de_DE.mo’); Shame on me it is a very obvious and … Read more

menu customization

I’m not sure, but if I understand correctly you should create a second menu which is only visible on your Spanish language page. if (is_page($english_page_id)) { wp_nav_menu( array(‘menu’=>$english_menu) ); } if (is_page($spanish_page_id)) { wp_nav_menu( array(‘menu’=>$spanish_menu) ) } is_page() wp_nav_menu()

Dealing with variables with gettext function

You could just rename the labels associated with that post type. class News_Post_Type { const POST_TYPE = ‘post’; public static function init() { $post_obj = get_post_type_object(‘post’); $post_obj->labels->name = __(‘News Post’, ‘textdomain’); $post_obj->labels->singular_name = __(‘News Post’, ‘textdomain’); // You can continue to rename all the label properties, this is just an example } } add_action( ‘init’, … Read more

How to call either page name as the nav link or navigation title?

I found the answer was to create my own walker with a little help from this article. This is it. The most important part being when it checks for the $language value (which is got from a cookie), and assigns the value of either $item->title or $item->description. class description_walker extends Walker_Nav_Menu { function start_el(&$output, $item, … Read more

Archive widget numbers translation?

For archives you can use the get_archives_link filter like this: add_filter(‘get_archives_link’, ‘translate_archive_month’); function translate_archive_month($list) { $patterns = array( ‘/January/’, ‘/February/’, ‘/March/’, ‘/April/’, ‘/May/’, ‘/June/’, ‘/July/’, ‘/August/’, ‘/September/’, ‘/October/’, ‘/November/’, ‘/December/’ ); $replacements = array( //Put here whatever you want ’01’, ’02’, ’03’, ’04’, ’05’, ’06’, ’07’, ’08’, ’09’, ’10’, ’11’, ’12’ ); $list = preg_replace($patterns, … Read more

How to translate placeholder?

In your code, you are concatenating a string but you are (from a comment) using a function that echos information– _e(). You can’t do that. You are printing the content wherever that array is constructed, which is not what you want. Use __() instead.