|
@@ 2359-2384 (lines=26) @@
|
| 2356 |
|
* @param bool $translate Whether to translate the time string. Default false. |
| 2357 |
|
* @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure. |
| 2358 |
|
*/ |
| 2359 |
|
function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { |
| 2360 |
|
$post = get_post($post); |
| 2361 |
|
|
| 2362 |
|
if ( ! $post ) { |
| 2363 |
|
return false; |
| 2364 |
|
} |
| 2365 |
|
|
| 2366 |
|
if ( $gmt ) |
| 2367 |
|
$time = $post->post_date_gmt; |
| 2368 |
|
else |
| 2369 |
|
$time = $post->post_date; |
| 2370 |
|
|
| 2371 |
|
$time = mysql2date($d, $time, $translate); |
| 2372 |
|
|
| 2373 |
|
/** |
| 2374 |
|
* Filters the localized time a post was written. |
| 2375 |
|
* |
| 2376 |
|
* @since 2.6.0 |
| 2377 |
|
* |
| 2378 |
|
* @param string $time The formatted time. |
| 2379 |
|
* @param string $d Format to use for retrieving the time the post was written. |
| 2380 |
|
* Accepts 'G', 'U', or php date format. Default 'U'. |
| 2381 |
|
* @param bool $gmt Whether to retrieve the GMT time. Default false. |
| 2382 |
|
*/ |
| 2383 |
|
return apply_filters( 'get_post_time', $time, $d, $gmt ); |
| 2384 |
|
} |
| 2385 |
|
|
| 2386 |
|
/** |
| 2387 |
|
* Display the time at which the post was last modified. |
|
@@ 2458-2481 (lines=24) @@
|
| 2455 |
|
* @param bool $translate Whether to translate the time string. Default false. |
| 2456 |
|
* @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure. |
| 2457 |
|
*/ |
| 2458 |
|
function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { |
| 2459 |
|
$post = get_post($post); |
| 2460 |
|
|
| 2461 |
|
if ( ! $post ) { |
| 2462 |
|
return false; |
| 2463 |
|
} |
| 2464 |
|
|
| 2465 |
|
if ( $gmt ) |
| 2466 |
|
$time = $post->post_modified_gmt; |
| 2467 |
|
else |
| 2468 |
|
$time = $post->post_modified; |
| 2469 |
|
$time = mysql2date($d, $time, $translate); |
| 2470 |
|
|
| 2471 |
|
/** |
| 2472 |
|
* Filters the localized time a post was last modified. |
| 2473 |
|
* |
| 2474 |
|
* @since 2.8.0 |
| 2475 |
|
* |
| 2476 |
|
* @param string $time The formatted time. |
| 2477 |
|
* @param string $d The date format. Accepts 'G', 'U', or php date format. Default 'U'. |
| 2478 |
|
* @param bool $gmt Whether to return the GMT time. Default false. |
| 2479 |
|
*/ |
| 2480 |
|
return apply_filters( 'get_post_modified_time', $time, $d, $gmt ); |
| 2481 |
|
} |
| 2482 |
|
|
| 2483 |
|
/** |
| 2484 |
|
* Display the weekday on which the post was written. |