How to make the front-end RTL without changing the admin panel language?

Set your WordPress to a RTL language, then use the following code in functions.php or as the plugin: <?php add_filter( ‘locale’, ‘my_set_admin_locale’ ); function my_set_admin_locale( $locale ) { // check if you are in the Admin area if( is_admin() ) { // set LTR locale $locale=”en_US”; } return( $locale ); } Or otherwise, set WordPress … Read more

variables in translatable text

The translation strings not only get parsed during rendering (output on screen/in browser), but also by the GNU gettext parser. This one is not a PHP parser, so it can’t fetch variables. This is the only part of a Theme or a Plugin, where you need to repeat yourself and add the plain string to … Read more

Simple way to get two language WP site

You can use below code for translating strings: add_filter(‘gettext’, ‘translate_text’); add_filter(‘ngettext’, ‘translate_text’); function translate_text($translated) { $translated = str_ireplace(‘Choose an option’, ‘Select’, $translated); $translated = str_ireplace(‘Original Text’, ‘Your Replacment Text’, $translated); return $translated; } But I have no idea for translating complex contents. I know you don’t want to use plugins but as my research, we … Read more

‘Trick’ a plugin (WP-Members) to think the blog language has changed for a single page

Yes, sort of. Any localized plugin such as WP-Members runs off of the “locale” that WordPress is set to. This value can be filtered for WP as a whole using the locale filter. But it can also be filtered for plugins using plugin_locale See: https://developer.wordpress.org/reference/hooks/plugin_locale/ To use plugin_locale specific to the text domain for the … Read more

Possible to add a language file to a plugin without adding .po/.mo files to plugin directory?

Best way to do this is probably by using a second, custom-made, plugin. Make a new plugin directory. Call it something like “example-com-custom-langs” or something unique to your site. In there, make a php file with a plugin header describing what the plugin does (for your own sanity), and do something like this: add_action(‘plugins_loaded’,’example_com_custom_langs_plugins_loaded’); function … Read more

html lang=”” instead of lang=”en-us” – why?

You can apply the language_attributes filter to language_attributes() function (source). Basically you can do this by adding something like this to your functions.php: add_filter(‘language_attributes’, ‘custom_lang_attr’); function custom_lang_attr() { return ‘lang=”en-US”‘; } Note: Keep in mind, that you’re overwriting the language parameter; the original string (see @param) is a space-separated list of language attributes.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)