- This topic has 3 replies, 1 voice, and was last updated 13 years, 8 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forums › Inside › This WordPress Site › Function get_date_from_gmt() returns GMT time, if called from bbPress page
I am looking for a solution to this problem.
WordPress function get_date_from_gmt($post->post_modified_gmt) usually returns a date and time in your site time zone. However, if this function is called from bbPress page, it always returns GMT time.
I started to dig dipper. Function depends on GMT offset returned by get_option(‘gmt_offset’). When called from bbPress this function returns nothing. As a result get_date_from_gmt() always returns GMT time.
Here is a chart:
function get_date_from_gmt() is in wp-includesformatting.php
function get_option() is in wp-includesfunctions.php
A TEMP solution for this problem is to hard-coded your offset fix in
wp-includesformatting.php:
// ***** 2011-03-08 TU 23:09 Use -5, if no offset returned *****
// $string_localtime = gmdate($format, $string_time +
get_option('gmt_offset')*3600);
$myOffset = (get_option('gmt_offset'))? get_option('gmt_offset'): -5;
$string_localtime = gmdate($format, $string_time + $myOffset*3600);
Problem solved using free NetBeans IDE 6.9.1 with Xdebug 2.1.0. Thank you!
All I had to do was to add one line of code to ‘bbpressmy-templatesMYfunctions.php’ file:
‘add_filter( ‘pre_option_gmt_offset’,’wp_timezone_override_offset’ );’
© 2017 DomainWebCenter.com. All Rights Reserved. | Disclaimer | Contact the Editor