• mattbooth

    (@mattbooth)


    Hi,

    The date format in the recent posts widget doesn’t seem to conform to the selection made in the WordPress settings. You may want to fix this. In the meantime could you please let me know how to fix it. I’m looking in the template-tags.php file, and I’m guessing it is something around here…

    $time_string = sprintf( $time_string,
    esc_attr( get_the_date( ‘c’ ) ),
    esc_html( get_the_date() ),
    esc_attr( get_the_modified_date( ‘c’ ) ),
    esc_html( get_the_modified_date() )
    );

    Thanks

    Matt

Viewing 1 replies (of 1 total)
  • Kimberly

    (@amiga500)

    if you want you can add filters to the wordpress stack that gets called which overrides what this theme is using and you can have it return the default date format.

    However, you can just add the changes to the files you want directly. To get the date format you would use: get_option(‘date_format’) and get_option( ‘time_format’ ) and you put it in as the param inside a function such as get_the_date(get_option(‘date_format’))

    I’d, however, recommend you add filters for get_post_time, get_the_date, and get_post_modified_time since all of this theme’s date displays go through them. The 2nd parameter is the date format.

    For example:

    add_filter(‘get_post_time’,’my_get_post_time’,99,3);
    add_filter(‘get_the_date’,’my_get_the_date’,99,3);
    add_filter(‘get_post_modified_time’,’my_get_post_modified_time’,99,3);

    And now set up your functions and do what you need to do. At least this way when the theme updates your changes will remain the same.

    Alternatively you can create a child theme and modify whatever you like.

    Btw, template-tags.php isnt the only file with the date thing. Hence why adding filters will cover all of them.

    Kimberly

Viewing 1 replies (of 1 total)
  • The topic ‘Date Format in Recent Posts Widget’ is closed to new replies.