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).
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!
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
Fixed, i copied only the "current_time(‘timestamp’)" part
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
Where in the list of questions does it need to be changed? Thanks
Thanks, that fixed it.
Well, it fixed it on the question page, but not in the list.
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'));
Thanks, fixed it
Please login or Register to submit your answer