Pets_QandA
asked 8 years ago

Whenever an Answer is posted, is says "answered 11 hours ago",
while in fact WordPress is set to Sydney timezone, which is indeed +11 hours from UTC (UTC time is 2016-02-28 02:01:25 Local time is 2016-02-28 13:01:25).

3 Answers
DominicStaff
answered 8 years ago

To resolve this issue, you can open the content-single-question.php file and find the line 19.
Replace the following code:

<?php printf( __( '<span>%s%s %s asked %s ago</span>', 'dwqa' ), dwqa_get_author_link( $user_id ), get_avatar( $user_id, 48 ), dwqa_get_author(),  dwqa_print_user_badge( $user_id ), human_time_diff( get_post_time( 'U' ) ) ) ?>

With new code:

<?php printf( __( '<span>%s%s %s asked %s ago</span>', 'dwqa' ), dwqa_get_author_link( $user_id ), get_avatar( $user_id, 48 ), dwqa_get_author(),  dwqa_print_user_badge( $user_id ), human_time_diff( get_post_time( 'U' ), current_time('timestamp') ) ) ?>

And open the content-single-answer.php file. Find the line 23.
Replace the following code:

<?php printf( __( '<span>%s%s %s asked %s ago</span>', 'dwqa' ), dwqa_get_author_link( $user_id ), get_avatar( $user_id, 48 ), dwqa_get_author(),  dwqa_print_user_badge( $user_id ), human_time_diff( get_post_time( 'U' ) ) ) ?>

With new code:

<?php printf( __( '<span>%s%s %s asked %s ago</span>', 'dwqa' ), dwqa_get_author_link( $user_id ), get_avatar( $user_id, 48 ), dwqa_get_author(),  dwqa_print_user_badge( $user_id ), human_time_diff( get_post_time( 'U' ), current_time('timestamp') ) ) ?>

Hope this helps!

riklisci
replied 8 years ago

Hi, i’m starting to test this plugin and timezone was the first issue seen. Your code is working for time, but return the author link in raw text form "http://www….", not the link

riklisci
replied 8 years ago

Fixed, i copied only the "current_time(‘timestamp’)" part

dominic Staff
replied 8 years ago

Yes, in my code that i have provided just added the current_time(‘timestamp’) . 😀
If you have any issue, you can create a new question and let me know. I will help you resolve it

pets_qanda
replied 8 years ago

Where in the list of questions does it need to be changed? Thanks

Pets_QandA
answered 8 years ago

Thanks, that fixed it.

pets_qanda
replied 8 years ago

Well, it fixed it on the question page, but not in the list.

DominicStaff
answered 8 years ago

About list question page, you can open the content-question.php file, find around line 17.
Replace it with the following code:

$time = human_time_diff( get_post_time( 'U' ), current_time('timestamp'));
pets_qanda
replied 8 years ago

Thanks, fixed it

Powered by DW Question & Answer Pro