This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is experiencing an issue where the PHP
date()
function is not displaying dates in the correct language on their Spanish translation page. The dates are being output with the data-date attribute set to "1970-01-01" instead of the correct effective date. The client has custom fields for dates that are set to COPY, and while the effective date is displayed next to the post title, the data attribute in the HTML is incorrect.
Solution:
We understand that the issue arises because the PHP
date()
function is using the server's locale to generate month names, which may not be translated by WPML's String Translation. This feature is intended for static strings and might not apply to dynamic content such as PHP-formatted dates. To translate month names and dates in WordPress using WPML, additional steps or configurations might be necessary, such as using WordPress-specific functions or hooks to localize the date strings. We found a solution on StackOverflow that could be helpful:
Please note that support for issues arising from custom coding is beyond our support scope. If you require assistance with custom coding, consider hiring a professional developer who specializes in customizing WPML and its extensions from https://wpml.org/contractors/.
If this solution is not relevant to your case, because it's outdated or not applicable, we recommend opening a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins.
If you need further assistance, please do not hesitate to contact us in the WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 2 replies, has 2 voices.
Last updated by 9 months, 1 week ago.
Assisted by: Prosenjit Barman.