@@ 2298-2322 (lines=25) @@ | ||
2295 | * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
|
2296 | * @return false|string Date the current post was modified. False on failure. |
|
2297 | */ |
|
2298 | function get_the_modified_date( $d = '', $post = null ) { |
|
2299 | $post = get_post( $post ); |
|
2300 | ||
2301 | if ( ! $post ) { |
|
2302 | // For backward compatibility, failures go through the filter below. |
|
2303 | $the_time = false; |
|
2304 | } elseif ( empty( $d ) ) { |
|
2305 | $the_time = get_post_modified_time( get_option( 'date_format' ), false, $post, true ); |
|
2306 | } else { |
|
2307 | $the_time = get_post_modified_time( $d, false, $post, true ); |
|
2308 | } |
|
2309 | ||
2310 | /** |
|
2311 | * Filters the date a post was last modified. |
|
2312 | * |
|
2313 | * @since 2.1.0 |
|
2314 | * @since 4.6.0 Added the `$post` parameter. |
|
2315 | * |
|
2316 | * @param string $the_time The formatted date. |
|
2317 | * @param string $d PHP date format. Defaults to value specified in |
|
2318 | * 'date_format' option. |
|
2319 | * @param WP_Post $post WP_Post object. |
|
2320 | */ |
|
2321 | return apply_filters( 'get_the_modified_date', $the_time, $d, $post ); |
|
2322 | } |
|
2323 | ||
2324 | /** |
|
2325 | * Display the time at which the post was written. |
|
@@ 2355-2379 (lines=25) @@ | ||
2352 | * @param int|WP_Post $post WP_Post object or ID. Default is global $post object. |
|
2353 | * @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure. |
|
2354 | */ |
|
2355 | function get_the_time( $d = '', $post = null ) { |
|
2356 | $post = get_post($post); |
|
2357 | ||
2358 | if ( ! $post ) { |
|
2359 | return false; |
|
2360 | } |
|
2361 | ||
2362 | if ( '' == $d ) |
|
2363 | $the_time = get_post_time(get_option('time_format'), false, $post, true); |
|
2364 | else |
|
2365 | $the_time = get_post_time($d, false, $post, true); |
|
2366 | ||
2367 | /** |
|
2368 | * Filters the time a post was written. |
|
2369 | * |
|
2370 | * @since 1.5.0 |
|
2371 | * |
|
2372 | * @param string $the_time The formatted time. |
|
2373 | * @param string $d Format to use for retrieving the time the post was written. |
|
2374 | * Accepts 'G', 'U', or php date format value specified |
|
2375 | * in 'time_format' option. Default empty. |
|
2376 | * @param int|WP_Post $post WP_Post object or ID. |
|
2377 | */ |
|
2378 | return apply_filters( 'get_the_time', $the_time, $d, $post ); |
|
2379 | } |
|
2380 | ||
2381 | /** |
|
2382 | * Retrieve the time at which the post was written. |
|
@@ 2453-2478 (lines=26) @@ | ||
2450 | * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
|
2451 | * @return false|string Formatted date string or Unix timestamp. False on failure. |
|
2452 | */ |
|
2453 | function get_the_modified_time( $d = '', $post = null ) { |
|
2454 | $post = get_post( $post ); |
|
2455 | ||
2456 | if ( ! $post ) { |
|
2457 | // For backward compatibility, failures go through the filter below. |
|
2458 | $the_time = false; |
|
2459 | } elseif ( empty( $d ) ) { |
|
2460 | $the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true ); |
|
2461 | } else { |
|
2462 | $the_time = get_post_modified_time( $d, false, $post, true ); |
|
2463 | } |
|
2464 | ||
2465 | /** |
|
2466 | * Filters the localized time a post was last modified. |
|
2467 | * |
|
2468 | * @since 2.0.0 |
|
2469 | * @since 4.6.0 Added the `$post` parameter. |
|
2470 | * |
|
2471 | * @param string $the_time The formatted time. |
|
2472 | * @param string $d Format to use for retrieving the time the post was |
|
2473 | * written. Accepts 'G', 'U', or php date format. Defaults |
|
2474 | * to value specified in 'time_format' option. |
|
2475 | * @param WP_Post $post WP_Post object. |
|
2476 | */ |
|
2477 | return apply_filters( 'get_the_modified_time', $the_time, $d, $post ); |
|
2478 | } |
|
2479 | ||
2480 | /** |
|
2481 | * Retrieve the time at which the post was last modified. |