Support » Fixing WordPress » How use custom locale (.mo/.po file) for custom posts? Is it proper thought?

  • Resolved Lrrr


    Hello there, I wrote an EN article on my blog. Its a first EN article in my blog history so Im facing an issue. Sometime I will write further.

    How I can specify that WP engine should use different locale for translated strings only for specific posts?
    No matter if its on sigle page or archive?

    I read some sources like but its not working unfortanetly for me nor this way will carry an permormance issue when used in archive i read somewhere…

    My progress to goal should be:
    1)Specify a taxonomy (tags category or custom) to sign the specific post
    2)detect it and assign the speciffic class (adding class not the question) to that post and consequently generate this post with other laguage strings in post footer etc.
    What I need is: Only one post in database only in one language as I wrote it! So I do not need translating text of the post. Just naturally wrote in english or in czech.

    Thank you for opinions. As a resuld should be this my post readable with proper english post footer, comments,connect etc. But only this one. Nest post shpould appear with czech footer, comments etc…

Viewing 6 replies - 1 through 6 (of 6 total)
  • This cannot be done from a theme but is possible from a plugin. This is because the locale is loaded before the theme file is included.

    Take a look at

    The original poster decided in the end not to use taxonomies but to add a language indicator to the end of the post slug. Because the loading of the locale happens so early in the process, any conditionals such asis_term() hasn’t been setup yet so you can’t use them.

    Thanks for respond.
    I will see the sources you gave me. (edit: first I know , second seems giving a clue! )
    Meanwhile, Im solving another issue with replacing strings given to the final html via shortcode which is part of a plugin.
    So you tell that I can not do upper thing from a theme (if i understand from a function.php in my child theme). So subsequently brings me a question. Is gennerally posible to filter a function which is inside the plugin from function.php in child theme?
    Because just now Im parsing shortcode and replacing. It could be much more elegant to do it via filter as filtering main theme.

    In general, basicly, I always assumed that via functions.php i can do anything in the wordpress… ?

    Thanks again for sources !

    Well you can do almost anything in a theme’s functions.php. Take a look at and then you can see that there are some actions that fire before the theme files are included. Thus, you cannot manipulate those from a theme file.

    Sorry, i forgot to answer your question about filtering a plugin. Yes it certainly is possible, but depends on how the plugin is written. The plugin needs to provide you with a filter in the first place.

    Ok, thanks. I will take the time tomorow (myabe today its 0:40 am for me now) good night 🙂

    I suspended this issue. Working with google translate. This way I decided as unapropriate. Thank you for answers I mark this thread as resolved 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How use custom locale (.mo/.po file) for custom posts? Is it proper thought?’ is closed to new replies.