elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.
https://elementor.com/
GNU General Public License v3.0
6.57k stars 1.41k forks source link

🔣 🐞 Bug Report: Post Info Date and Archive Title Date do not respect translated date format #21555

Open JboyJW opened 1 year ago

JboyJW commented 1 year ago

Prerequisites

Description

I am using WPML for a multilingual site and Elementor to build my template. I am translating the default date format of the site so that dates are formatted in the correct order and not just having the months translated.

The Posts widget that includes showing Date in the Meta Data section, will display the date with the correct translated date format.

The Post Info widget however, when showing the Date Meta Data, using the Default Date Format, does not show in my translated date format. It only translates the month name.

The Archive Title widget when viewing a date archive page, also translates the month name only and does not show the date in my translated date format.

Steps to reproduce

1) Use the latest versions of WPML, WPML String Translation, Elementor, and Elementor Pro. 2) Set up a second language. 3) Set up a Single Post template that includes a Post Info widget that displays the Date Meta Data and uses the Default Date Format. 4) Set up an Archive template that includes an Archive Title widget. 5) Follow the WPML instructions for translating the default date format: https://wpml.org/documentation/getting-started-guide/translating-your-sites-date-format-using-wpml/ 6) Create a post in the default language and translate the post in your second language. 7) Visit the date archive page that includes the date of the post you created ie. /2023/03/05 and then visit it in your second language and see that the date in the title does not use your translated format. 8) Click on the post and see that the date shown is not in your translated date format.

Isolating the problem

System Info

== Server Environment == Operating System: Linux Software: Apache MySQL version: MariaDB Server v10.3.27 PHP Version: 7.4.33 PHP Memory Limit: 128M PHP Max Input Vars: 3000 PHP Max Post Size: 40M GD Installed: Yes ZIP Installed: Yes Write Permissions: All right Elementor Library: Connected

== WordPress Environment == Version: 6.1.1 Site URL: https://staging.chaus.ca/chigamik Home URL: https://staging.chaus.ca/chigamik/en WP Multisite: No Max Upload Size: 20 MB Memory limit: 512M Max Memory limit: 512M Permalink Structure: /%category%/%postname% Language: en-US Timezone: America/Toronto Admin Email: jason@homecooked.ca Debug Mode: Inactive

== Theme == Name: Hello Elementor Child Version: 1.0.1 Author: Elementor Team Child Theme: Yes Parent Theme Name: Hello Elementor Parent Theme Version: 2.6.1 Parent Theme Author: Elementor Team

== User == Role: administrator WP Profile lang: en_US User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

== Active Plugins == Admin Menu Editor Version: 1.10.4 Author: Janis Elsts

Advanced Editor Tools (previously TinyMCE Advanced)
    Version: 5.6.0
    Author: Automattic

All in One SEO
    Version: 4.3.2
    Author: All in One SEO Team

Black Studio TinyMCE Widget
    Version: 2.7.2
    Author: Black Studio

Classic Editor
    Version: 1.6.2
    Author: WordPress Contributors

Classic Widgets
    Version: 0.3
    Author: WordPress Contributors

Elementor
    Version: 3.11.2
    Author: Elementor.com

Elementor Pro
    Version: 3.11.3
    Author: Elementor.com

EWWW Image Optimizer
    Version: 6.9.3
    Author: Exactly WWW

Gravity Forms
    Version: 2.7.2
    Author: Gravity Forms

Gravity Forms Multilingual
    Version: 1.7.1
    Author: OnTheGoSystems

Simple Page Ordering
    Version: 2.4.4
    Author: 10up

SVG Support
    Version: 2.5.5
    Author: Benbodhi

UpdraftPlus - Backup/Restore
    Version: 1.22.24
    Author: UpdraftPlus.Com, DavidAnderson

WP Accessibility
    Version: 2.0.1
    Author: Joe Dolson

WPML Media
    Version: 2.7.1
    Author: OnTheGoSystems

WPML Multilingual CMS
    Version: 4.5.14
    Author: OnTheGoSystems

WPML String Translation
    Version: 3.2.3
    Author: OnTheGoSystems

Yoast Duplicate Post
    Version: 4.5
    Author: Enrico Battocchi & Team Yoast

== Must-Use Plugins == Elementor Safe Mode Version: 1.0.0 Author: Elementor.com

== Elements Usage ==

section : 8
    button : 17
    heading : 9
    icon-list : 3
    image : 5
    social-icons : 1
    spacer : 1
    text-editor : 3
    wpml-language-switcher : 1
wp-post : 16
    button : 7
    heading : 5
    icon-list : 1
    image : 2
    text-editor : 22
    video : 1
wp-page : 76
    button : 57
    heading : 163
    icon : 1
    icon-list : 14
    image : 39
    menu-anchor : 2
    text-editor : 125

== Settings ==

cpt_support: post, page, e-landing-page
allow_tracking: yes
unfiltered_files_upload: 1

== Features == Custom Fonts: 0 Custom Icons: 0

== Integrations ==

== Elementor Experiments == Optimized DOM Output: Active by default Improved Asset Loading: Active by default Improved CSS Loading: Active by default Inline Font Icons: Inactive by default Accessibility Improvements: Active by default Additional Custom Breakpoints: Active by default admin_menu_rearrangement: Inactive by default Flexbox Container: Inactive by default Upgrade Swiper Library: Inactive by default Default to New Theme Builder: Active by default Hello Theme Header & Footer: Active by default Editor V2: Inactive by default Landing Pages: Active by default Nested Elements: Inactive by default Lazy Load Background Images: Inactive by default Save as Default: Active by default Page Transitions: Active by default Notes: Active by default Loop: Active by default Form Submissions: Active by default Scroll Snap: Active by default Mega Menu: Inactive by default

== Log ==

Log: showing 17 of 172023-02-14 11:44:32 [info] Elementor data updater process has been queued. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.5.2', 'to' => '3.11.0', )] 2023-02-14 11:44:40 [info] elementor-pro::elementor_pro_updater Started 2023-02-14 11:44:40 [info] Elementor Pro/Upgrades - _on_each_version Start
2023-02-14 11:44:40 [info] Elementor Pro/Upgrades - _on_each_version Finished 2023-02-14 11:44:40 [info] Elementor Pro/Upgrades - _v_3_7_2_woocommerce_rename_related_to_related_products Start
2023-02-14 11:44:41 [info] Elementor Pro/Upgrades - _v_3_7_2_woocommerce_rename_related_to_related_products Finished 2023-02-14 11:44:41 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.5.2', 'to' => '3.11.0', )] 2023-03-05 11:05:49 [info] Elementor data updater process has been queued. [array ( 'plugin' => 'Elementor', 'from' => '3.11.0', 'to' => '3.11.2', )] 2023-03-05 11:05:49 [info] Elementor data updater process has been queued. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.11.0', 'to' => '3.11.3', )] 2023-03-05 11:13:03 [info] elementor::elementor_updater Started 2023-03-05 11:13:03 [info] Elementor/Upgrades - _on_each_version Start
2023-03-05 11:13:03 [info] Elementor/Upgrades - _on_each_version Finished 2023-03-05 11:13:03 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '3.11.0', 'to' => '3.11.2', )] 2023-03-05 11:13:07 [info] elementor-pro::elementor_pro_updater Started 2023-03-05 11:13:07 [info] Elementor Pro/Upgrades - _on_each_version Start
2023-03-05 11:13:07 [info] Elementor Pro/Upgrades - _on_each_version Finished 2023-03-05 11:13:07 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.11.0', 'to' => '3.11.3', )]

JS: showing 2 of 2JS: 2023-02-14 18:11:11 [error X 11][https://staging.chaus.ca/chigamik/wp-admin/load-scripts.php?c=1&loadchunk_0=jquery-core,jquery-migrate,underscore,backbone,jquery-ui-core,jquery-ui-mouse,wp-api-request,regenerator-runtime,wp-polyfill,wp-&loadchunk_1=hooks&ver=6.1.1:2:51816] a is undefined JS: 2023-02-16 19:57:39 [error X 4][https://staging.chaus.ca/chigamik/wp-admin/load-scripts.php?c=1&loadchunk_0=jquery-core,jquery-migrate,underscore,backbone,jquery-ui-core,jquery-ui-mouse,wp-api-request,regenerator-runtime,wp-polyfill,wp-&loadchunk_1=hooks&ver=6.1.1:2:51824] Cannot read properties of undefined (reading 'replace')

PHP: showing 20 of 24PHP: 2023-02-14 16:51:15 [warning X 2][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 4762 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-14 16:53:02 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 4310 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-14 17:01:58 [warning X 2][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 33361 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-14 17:02:49 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 2664 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-14 17:03:05 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 2109 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-14 17:03:11 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 16267 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-14 17:09:10 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 4749 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-14 17:10:40 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 10568 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 10:37:45 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only 4096 of 4310 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:12:36 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 20767 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:15:04 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 16508 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:15:12 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 14936 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:15:16 [warning X 2][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 8059 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:16:19 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 4950 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:18:16 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 26124 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:18:17 [warning X 1][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 10459 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 11:18:38 [warning X 4][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 9269 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 12:03:30 [notice X 40][/home/staging/public_html/chigamik/wp-content/plugins/elementor-pro/modules/posts/skins/skin-content-base.php::264] Trying to get property 'ID' of non-object [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-16 12:20:48 [warning X 2][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/files/base.php::194] file_put_contents(): Only -1 of 9753 bytes written, possibly out of free disk space [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )] PHP: 2023-02-21 11:19:10 [notice X 8][/home/staging/public_html/chigamik/wp-content/plugins/elementor/core/common/modules/ajax/module.php::175] Undefined index: data [array ( 'trace' => '

0: Elementor\Core\Logger\Manager -> shutdown()

', )]

== Elementor - Compatibility Tag ==

Elementor Pro: Compatible

== Elementor Pro - Compatibility Tag ==

JboyJW commented 1 year ago

Any chance this bug will be addressed anytime soon?

Sol-Cryss commented 3 months ago

There is also another bug in the same area, which hinders translations by filters. One would expect the DATE meta for the Post Info Widget to use get_the_date() as opposed to get_the_time(). This would make filtering the date easier with WP Filters.

Secondly, would it be possible to, when using the "Default" date format, use the WordPress default option for date_format?

Something like this...

File: /elementor-pro/modules/theme-elements/widgets/post-info.php : 778

Edit: Nerfed the PasteBin link as I realised I should have just put the get_option('date_format') into the "Default" value in the $format_options instead of the goofy inline IF statement I used.

    case 'date':
        $custom_date_format = empty( $repeater_item['custom_date_format'] ) ? 'F j, Y' : $repeater_item['custom_date_format'];

        $format_options = [
            'default' => get_option('date_format'),
            '0' => 'F j, Y',
            '1' => 'Y-m-d',
            '2' => 'm/d/Y',
            '3' => 'd/m/Y',
            'custom' => $custom_date_format,
        ];

        $item_data['text'] = get_the_date( $format_options[ $repeater_item['date_format'] ] );
        $item_data['icon'] = 'fa fa-calendar'; // Default icon
        $item_data['selected_icon'] = [
            'value' => 'fas fa-calendar',
            'library' => 'fa-solid',
        ]; // Default icons.
        $item_data['itemprop'] = 'datePublished';

        if ( 'yes' === $repeater_item['link'] ) {
            $item_data['url'] = [
                'url' => get_day_link( get_post_time( 'Y' ), get_post_time( 'm' ), get_post_time( 'j' ) ),
            ];
        }
        break;
xzax commented 3 months ago

The same bug is also in loop items as well.