@@ 2393-2418 (lines=26) @@ | ||
2390 | * @param bool $translate Whether to translate the time string. Default false. |
|
2391 | * @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure. |
|
2392 | */ |
|
2393 | function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { |
|
2394 | $post = get_post($post); |
|
2395 | ||
2396 | if ( ! $post ) { |
|
2397 | return false; |
|
2398 | } |
|
2399 | ||
2400 | if ( $gmt ) |
|
2401 | $time = $post->post_date_gmt; |
|
2402 | else |
|
2403 | $time = $post->post_date; |
|
2404 | ||
2405 | $time = mysql2date($d, $time, $translate); |
|
2406 | ||
2407 | /** |
|
2408 | * Filters the localized time a post was written. |
|
2409 | * |
|
2410 | * @since 2.6.0 |
|
2411 | * |
|
2412 | * @param string $time The formatted time. |
|
2413 | * @param string $d Format to use for retrieving the time the post was written. |
|
2414 | * Accepts 'G', 'U', or php date format. Default 'U'. |
|
2415 | * @param bool $gmt Whether to retrieve the GMT time. Default false. |
|
2416 | */ |
|
2417 | return apply_filters( 'get_post_time', $time, $d, $gmt ); |
|
2418 | } |
|
2419 | ||
2420 | /** |
|
2421 | * Display the time at which the post was last modified. |
|
@@ 2492-2515 (lines=24) @@ | ||
2489 | * @param bool $translate Whether to translate the time string. Default false. |
|
2490 | * @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure. |
|
2491 | */ |
|
2492 | function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { |
|
2493 | $post = get_post($post); |
|
2494 | ||
2495 | if ( ! $post ) { |
|
2496 | return false; |
|
2497 | } |
|
2498 | ||
2499 | if ( $gmt ) |
|
2500 | $time = $post->post_modified_gmt; |
|
2501 | else |
|
2502 | $time = $post->post_modified; |
|
2503 | $time = mysql2date($d, $time, $translate); |
|
2504 | ||
2505 | /** |
|
2506 | * Filters the localized time a post was last modified. |
|
2507 | * |
|
2508 | * @since 2.8.0 |
|
2509 | * |
|
2510 | * @param string $time The formatted time. |
|
2511 | * @param string $d The date format. Accepts 'G', 'U', or php date format. Default 'U'. |
|
2512 | * @param bool $gmt Whether to return the GMT time. Default false. |
|
2513 | */ |
|
2514 | return apply_filters( 'get_post_modified_time', $time, $d, $gmt ); |
|
2515 | } |
|
2516 | ||
2517 | /** |
|
2518 | * Display the weekday on which the post was written. |