When I develop a plugin, do I always have to use: load_plugin_textdomain('whatever', '', 'whatever/languages'); Or is there any setup, so that I put my translations into a specific folder with a specific name and they get loaded by default with the domain being the plugin slug? Reason is, I don't like to use that second deprecated paramenter. I prefer to omit the whole call to the function if a default setup exists.
Short description: I try to translate strings in JS file. To test it I decided to create a simple test plugin. I have PHP and JS strings there. Translated PHP strings work fine, JS strings don't work. Tools and environment: WP-CLI 2.4.0 Wordpress 5.5.1 Ubuntu 20.04 Original languange: English (United States) Translate language: German Plugin PHP file content: <?php /* * Plugin Name: Test * Text Domain: test * Domain Path: /languages */ /** * Init all */ function run() …
I want to display dates in Hindi format like jan 10 using get_the_date() function. What I have tried so far: echo get_the_date(_e('F j')); which outputs: F jJanuary 10, 2017.
I am coming from a multi-linguo country, and viewers may speak different language. I am writing a theme and I noticed that the language of my theme only changed based on the setting of my admin panel, which mean only logged-in user or admin can do so. What if I wanted to do it automatically by detecting user browser preference? I am using Jquery to achieve some of this function but thinking it not the right way. What I was …
How can I generate dynamic pages on a Wordpress website from information provided in a separate MySQL database? I have a database with Locations and I would like to have a page for each of these created dynamically. For example, I have a database entry for LOCATION1. If the location exists in the database, I would like a page such as www.example.com/LOCATION1/ and for the content to be dynamic, using information from the database.
I have a parent theme and a child theme, I would like to override the spanish .mo and .po files in the parent theme (or add them if they are not present in the parent theme) with the es_ES ones in my child theme. I added the folder with the modified mo and po files in the child theme with the same folder name as in the parent theme but this is not working. How can I come about this? …
I am hooking into comment_form_default_fields doing some heavy string replacements. There are translated strings like __( 'Name' ) in there. I need the text. I have two or three different ways to solve this. I could just use my own text domain, but that would mean I have to provide my own translation for my code, do not like that. Especially because I just reuse already translated strings. Extract the text (with regex). Better but not a huge fan either. …
I am trying to get a php file to input content into the wordpress database under a specific table. I have set up the table and have verified that the information is passed into the insert.php file. THe issue is that I can not include the global $wpdb and when i call for a required once on the wp_config file or the other required files it gives me this error in the php logs: [22-Aug-2015 18:07:03 Europe/Berlin] PHP Fatal error: …
I am trying to load localization for my plugin. There is directory called languages in my plugin folder with .po and .mo files inside of it. I have the following code in the plugin main file: <?php function myplugin_lang_init() { $domain = 'mydomain'; // The "plugin_locale" filter is also used in load_plugin_textdomain() $locale = apply_filters('plugin_locale', get_locale(), $domain); load_textdomain($domain, WP_LANG_DIR.'/plugins/'.$domain.'-'.$locale.'.mo'); load_plugin_textdomain($domain, FALSE, dirname(plugin_basename(__FILE__)).'/languages/'); } // myplugin_lang_init(); // That works add_action('plugins_loaded', 'myplugin_lang_init'); // I don't know why but it doesn't work That …
From start: A = main plugin(the library), B = child plugin I develop a plugin B that will depend on another plugin A in order to work properly. I do this because I'm one of the persons who don't like code duplication. So I have a plugin with the library required for other plugins A and another plugin that will do only what it should but only if plugin A is activated. Everything is working well, but... I also need …
Let's say my website in English, and I created a Spanish category which I want it to be Spanish language, it and it's child posts. How can I achieve this?
I have a need to display a time-of-day value in a site's chosen time format. For example I have 16:42:18 and want to display it as 4:42 PM if the time_format option is g:i A, or 16:42:18 if the time_format is H:i:s. I need this to render data captured by HTML5's <input type="time"> form field. How to do this?
By default in a network install, when viewing a sub-site, the sub-site language is used for the admin bar (toolbar). How can I have the admin bar (toolbar) always use the language of the user?
I face the following situation: after manually adding (in the backend) the terms with names (not slugs) Mânie and Manie, that differs only in an accent/diacritic (they are totally different words with totally different meanings), to a non-hierarchical custom taxonomy (tags), no matter what slugs were set (I tried the slug pairs minie/manie and manie/manie-2 for that term names), when I try to set these terms to a post, also from backend, when I save the post Wordpress randomly accepts …
Is it possible to find it out by examining the source code or by using the developer feature Inspect (like a style and its corresponding .css)? I know I can copy the entire content of the site and then search it with fulltext, but that's time consuming.
I made a plugin with existing localization on WordPress.org for free. I migrated to block.json and made all changes by comparing it to the output of npx @wordpress/create-block todo-list. I read through the Block Editor guide on internationalization but there seem to be a few differences to the way it works in the todo-list example. The result is that all my __ php functions work and translate all strings. But my __ JavaScript function does not translate any of the …
The scenario is to run insert_post function every midnight (00:00) of local time. Must run daily on weekday. function add_daily_task(){ if((date('l', time()) != 'Saturday') || (date('l', time()) != 'Sunday')){ // insert post } } if(!wp_next_scheduled( 'add_daily_task_schedule')){ wp_schedule_event(time(), 'daily', 'add_daily_task_schedule'); // how should change time() to meet my local schedule? } add_action('add_daily_task_schedule', 'add_daily_task');
I'm changing the locale using the locale filter. I've tried various methods; creating a plugin and hooking into filter, declaring locale filter hook in the functions.php file, and even as simply as defining my WPLANG constant; in all cases, only my theme .mo file is translated, not any of the plugins. My custom theme .mo file loads the correct translations but not the plugins. I'm wondering why the plugins are not showing the appropriate .mo translations when locale is changed? …