Support » Theme: Emmet Lite » Bug: Impossible to localize post dates.

  • Resolved oilgarch

    (@oilgarch)


    This otherwise excellent theme uses get_post_time() function in many places and it is hard-coded to take only the first argument:

    get_post_time('F j, Y');

    As as result it is impossible to show the theme in another language because all the dates (month names etc.) remain in English. The solution is to change above function to the following:

    get_post_time('F j, Y',false,null,true );

    Then the theme will automatically display dates in foreign locale format when the site in another language. The function’s 4th argument is responsible for enabling automatic translation.

    Reference: get_post_time()

    List of files with the function:

    content-masonry-audio.php
     content-masonry-video.php
     inc/theme/init.php
     content-masonry.php
     init.php
     content-columns.php
     lastnews.php
     content-single.php
     sections/lastnews.php

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author MotoPress

    (@motopress)

    Hi,
    Thank you for your notification. We’ll examine this case and make appropriate changes. We appreciate your feedback.

    It may also make sense to replace the hard-coded ‘F j, Y’ string with:

    get_post_time( get_option('date_format','F j, Y') , false,null,true );

    so that the user could set his preferred time format in /wp-admin/options-general.php

    Reference: get_option()

    Theme Author MotoPress

    (@motopress)

    Hi,
    Thank you for cooperation.

    Definitely use get_option( 'date_format' ). This should’ve been caught in the review process. An alternative is to simply use get_the_date().

    Basically, never set the date/time format without a specific design-related reason. Then, if you do set a custom format, make sure to internationalize it like so:

    __( 'F j, Y', 'theme-textdomain' )
    Theme Author MotoPress

    (@motopress)

    Hi Justin,
    Thank you. We keep it in mind. Have a nice day.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Bug: Impossible to localize post dates.’ is closed to new replies.