276 * Filters the array of arguments used when generating the search form. |
277 * Filters the array of arguments used when generating the search form. |
277 * |
278 * |
278 * @since 5.2.0 |
279 * @since 5.2.0 |
279 * |
280 * |
280 * @param array $args The array of arguments for building the search form. |
281 * @param array $args The array of arguments for building the search form. |
|
282 * See get_search_form() for information on accepted arguments. |
281 */ |
283 */ |
282 $args = apply_filters( 'search_form_args', $args ); |
284 $args = apply_filters( 'search_form_args', $args ); |
|
285 |
|
286 // Ensure that the filtered arguments contain all required default values. |
|
287 $args = array_merge( $defaults, $args ); |
283 |
288 |
284 $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml'; |
289 $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml'; |
285 |
290 |
286 /** |
291 /** |
287 * Filters the HTML format of the search form. |
292 * Filters the HTML format of the search form. |
290 * @since 5.5.0 The `$args` parameter was added. |
295 * @since 5.5.0 The `$args` parameter was added. |
291 * |
296 * |
292 * @param string $format The type of markup to use in the search form. |
297 * @param string $format The type of markup to use in the search form. |
293 * Accepts 'html5', 'xhtml'. |
298 * Accepts 'html5', 'xhtml'. |
294 * @param array $args The array of arguments for building the search form. |
299 * @param array $args The array of arguments for building the search form. |
|
300 * See get_search_form() for information on accepted arguments. |
295 */ |
301 */ |
296 $format = apply_filters( 'search_form_format', $format, $args ); |
302 $format = apply_filters( 'search_form_format', $format, $args ); |
297 |
303 |
298 $search_form_template = locate_template( 'searchform.php' ); |
304 $search_form_template = locate_template( 'searchform.php' ); |
299 |
305 |
301 ob_start(); |
307 ob_start(); |
302 require $search_form_template; |
308 require $search_form_template; |
303 $form = ob_get_clean(); |
309 $form = ob_get_clean(); |
304 } else { |
310 } else { |
305 // Build a string containing an aria-label to use for the search form. |
311 // Build a string containing an aria-label to use for the search form. |
306 if ( isset( $args['aria_label'] ) && $args['aria_label'] ) { |
312 if ( $args['aria_label'] ) { |
307 $aria_label = 'aria-label="' . esc_attr( $args['aria_label'] ) . '" '; |
313 $aria_label = 'aria-label="' . esc_attr( $args['aria_label'] ) . '" '; |
308 } else { |
314 } else { |
309 /* |
315 /* |
310 * If there's no custom aria-label, we can set a default here. At the |
316 * If there's no custom aria-label, we can set a default here. At the |
311 * moment it's empty as there's uncertainty about what the default should be. |
317 * moment it's empty as there's uncertainty about what the default should be. |
338 * @since 2.7.0 |
344 * @since 2.7.0 |
339 * @since 5.5.0 The `$args` parameter was added. |
345 * @since 5.5.0 The `$args` parameter was added. |
340 * |
346 * |
341 * @param string $form The search form HTML output. |
347 * @param string $form The search form HTML output. |
342 * @param array $args The array of arguments for building the search form. |
348 * @param array $args The array of arguments for building the search form. |
|
349 * See get_search_form() for information on accepted arguments. |
343 */ |
350 */ |
344 $result = apply_filters( 'get_search_form', $form, $args ); |
351 $result = apply_filters( 'get_search_form', $form, $args ); |
345 |
352 |
346 if ( null === $result ) { |
353 if ( null === $result ) { |
347 $result = $form; |
354 $result = $form; |
997 |
1004 |
998 /** |
1005 /** |
999 * Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
1006 * Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
1000 * |
1007 * |
1001 * @since 4.5.0 |
1008 * @since 4.5.0 |
1002 * @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support. |
1009 * @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support |
|
1010 * for the `custom-logo` theme feature. |
1003 * @since 5.5.1 Disabled lazy-loading by default. |
1011 * @since 5.5.1 Disabled lazy-loading by default. |
1004 * |
1012 * |
1005 * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog. |
1013 * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog. |
1006 * @return string Custom logo markup. |
1014 * @return string Custom logo markup. |
1007 */ |
1015 */ |
1076 ); |
1084 ); |
1077 } |
1085 } |
1078 } elseif ( is_customize_preview() ) { |
1086 } elseif ( is_customize_preview() ) { |
1079 // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). |
1087 // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). |
1080 $html = sprintf( |
1088 $html = sprintf( |
1081 '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo"/></a>', |
1089 '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" alt="" /></a>', |
1082 esc_url( home_url( '/' ) ) |
1090 esc_url( home_url( '/' ) ) |
1083 ); |
1091 ); |
1084 } |
1092 } |
1085 |
1093 |
1086 if ( $switched_blog ) { |
1094 if ( $switched_blog ) { |
1228 * } |
1236 * } |
1229 */ |
1237 */ |
1230 $title = apply_filters( 'document_title_parts', $title ); |
1238 $title = apply_filters( 'document_title_parts', $title ); |
1231 |
1239 |
1232 $title = implode( " $sep ", array_filter( $title ) ); |
1240 $title = implode( " $sep ", array_filter( $title ) ); |
1233 $title = wptexturize( $title ); |
1241 |
1234 $title = convert_chars( $title ); |
1242 /** |
1235 $title = esc_html( $title ); |
1243 * Filters the document title. |
1236 $title = capital_P_dangit( $title ); |
1244 * |
|
1245 * @since 5.8.0 |
|
1246 * |
|
1247 * @param string $title Document title. |
|
1248 */ |
|
1249 $title = apply_filters( 'document_title', $title ); |
1237 |
1250 |
1238 return $title; |
1251 return $title; |
1239 } |
1252 } |
1240 |
1253 |
1241 /** |
1254 /** |
1337 |
1350 |
1338 // If there's a month. |
1351 // If there's a month. |
1339 if ( is_archive() && ! empty( $m ) ) { |
1352 if ( is_archive() && ! empty( $m ) ) { |
1340 $my_year = substr( $m, 0, 4 ); |
1353 $my_year = substr( $m, 0, 4 ); |
1341 $my_month = $wp_locale->get_month( substr( $m, 4, 2 ) ); |
1354 $my_month = $wp_locale->get_month( substr( $m, 4, 2 ) ); |
1342 $my_day = intval( substr( $m, 6, 2 ) ); |
1355 $my_day = (int) substr( $m, 6, 2 ); |
1343 $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' ); |
1356 $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' ); |
1344 } |
1357 } |
1345 |
1358 |
1346 // If there's a year. |
1359 // If there's a year. |
1347 if ( is_archive() && ! empty( $year ) ) { |
1360 if ( is_archive() && ! empty( $year ) ) { |
2221 // week_begins = 0 stands for Sunday. |
2234 // week_begins = 0 stands for Sunday. |
2222 $week_begins = (int) get_option( 'start_of_week' ); |
2235 $week_begins = (int) get_option( 'start_of_week' ); |
2223 |
2236 |
2224 // Let's figure out when we are. |
2237 // Let's figure out when we are. |
2225 if ( ! empty( $monthnum ) && ! empty( $year ) ) { |
2238 if ( ! empty( $monthnum ) && ! empty( $year ) ) { |
2226 $thismonth = zeroise( intval( $monthnum ), 2 ); |
2239 $thismonth = zeroise( (int) $monthnum, 2 ); |
2227 $thisyear = (int) $year; |
2240 $thisyear = (int) $year; |
2228 } elseif ( ! empty( $w ) ) { |
2241 } elseif ( ! empty( $w ) ) { |
2229 // We need to get the month from MySQL. |
2242 // We need to get the month from MySQL. |
2230 $thisyear = (int) substr( $m, 0, 4 ); |
2243 $thisyear = (int) substr( $m, 0, 4 ); |
2231 // It seems MySQL's weeks disagree with PHP's. |
2244 // It seems MySQL's weeks disagree with PHP's. |
2468 * @since 0.71 |
2481 * @since 0.71 |
2469 * |
2482 * |
2470 * @global string $currentday The day of the current post in the loop. |
2483 * @global string $currentday The day of the current post in the loop. |
2471 * @global string $previousday The day of the previous post in the loop. |
2484 * @global string $previousday The day of the previous post in the loop. |
2472 * |
2485 * |
2473 * @param string $format Optional. PHP date format defaults to the date_format option if not specified. |
2486 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. |
2474 * @param string $before Optional. Output before the date. |
2487 * @param string $before Optional. Output before the date. Default empty. |
2475 * @param string $after Optional. Output after the date. |
2488 * @param string $after Optional. Output after the date. Default empty. |
2476 * @param bool $echo Optional. Whether to echo the date or return it. Default true. |
2489 * @param bool $echo Optional. Whether to echo the date or return it. Default true. |
2477 * @return string|void String if retrieving. |
2490 * @return string|void String if retrieving. |
2478 */ |
2491 */ |
2479 function the_date( $format = '', $before = '', $after = '', $echo = true ) { |
2492 function the_date( $format = '', $before = '', $after = '', $echo = true ) { |
2480 global $currentday, $previousday; |
2493 global $currentday, $previousday; |
2490 * Filters the date a post was published for display. |
2503 * Filters the date a post was published for display. |
2491 * |
2504 * |
2492 * @since 0.71 |
2505 * @since 0.71 |
2493 * |
2506 * |
2494 * @param string $the_date The formatted date string. |
2507 * @param string $the_date The formatted date string. |
2495 * @param string $format PHP date format. Defaults to 'date_format' option |
2508 * @param string $format PHP date format. |
2496 * if not specified. |
|
2497 * @param string $before HTML output before the date. |
2509 * @param string $before HTML output before the date. |
2498 * @param string $after HTML output after the date. |
2510 * @param string $after HTML output after the date. |
2499 */ |
2511 */ |
2500 $the_date = apply_filters( 'the_date', $the_date, $format, $before, $after ); |
2512 $the_date = apply_filters( 'the_date', $the_date, $format, $before, $after ); |
2501 |
2513 |
2512 * Unlike the_date() this function will always return the date. |
2524 * Unlike the_date() this function will always return the date. |
2513 * Modify output with the {@see 'get_the_date'} filter. |
2525 * Modify output with the {@see 'get_the_date'} filter. |
2514 * |
2526 * |
2515 * @since 3.0.0 |
2527 * @since 3.0.0 |
2516 * |
2528 * |
2517 * @param string $format Optional. PHP date format defaults to the date_format option if not specified. |
2529 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. |
2518 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2530 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2519 * @return string|false Date the current post was written. False on failure. |
2531 * @return string|false Date the current post was written. False on failure. |
2520 */ |
2532 */ |
2521 function get_the_date( $format = '', $post = null ) { |
2533 function get_the_date( $format = '', $post = null ) { |
2522 $post = get_post( $post ); |
2534 $post = get_post( $post ); |
2533 * Filters the date a post was published. |
2545 * Filters the date a post was published. |
2534 * |
2546 * |
2535 * @since 3.0.0 |
2547 * @since 3.0.0 |
2536 * |
2548 * |
2537 * @param string $the_date The formatted date. |
2549 * @param string $the_date The formatted date. |
2538 * @param string $format PHP date format. Defaults to 'date_format' option |
2550 * @param string $format PHP date format. |
2539 * if not specified. |
|
2540 * @param int|WP_Post $post The post object or ID. |
2551 * @param int|WP_Post $post The post object or ID. |
2541 */ |
2552 */ |
2542 return apply_filters( 'get_the_date', $the_date, $format, $post ); |
2553 return apply_filters( 'get_the_date', $the_date, $format, $post ); |
2543 } |
2554 } |
2544 |
2555 |
2545 /** |
2556 /** |
2546 * Display the date on which the post was last modified. |
2557 * Display the date on which the post was last modified. |
2547 * |
2558 * |
2548 * @since 2.1.0 |
2559 * @since 2.1.0 |
2549 * |
2560 * |
2550 * @param string $format Optional. PHP date format defaults to the date_format option if not specified. |
2561 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. |
2551 * @param string $before Optional. Output before the date. |
2562 * @param string $before Optional. Output before the date. Default empty. |
2552 * @param string $after Optional. Output after the date. |
2563 * @param string $after Optional. Output after the date. Default empty. |
2553 * @param bool $echo Optional. Whether to echo the date or return it. Default true. |
2564 * @param bool $echo Optional. Whether to echo the date or return it. Default true. |
2554 * @return string|void String if retrieving. |
2565 * @return string|void String if retrieving. |
2555 */ |
2566 */ |
2556 function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) { |
2567 function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) { |
2557 $the_modified_date = $before . get_the_modified_date( $format ) . $after; |
2568 $the_modified_date = $before . get_the_modified_date( $format ) . $after; |
2559 /** |
2570 /** |
2560 * Filters the date a post was last modified for display. |
2571 * Filters the date a post was last modified for display. |
2561 * |
2572 * |
2562 * @since 2.1.0 |
2573 * @since 2.1.0 |
2563 * |
2574 * |
2564 * @param string $the_modified_date The last modified date. |
2575 * @param string|false $the_modified_date The last modified date or false if no post is found. |
2565 * @param string $format PHP date format. Defaults to 'date_format' option |
2576 * @param string $format PHP date format. |
2566 * if not specified. |
2577 * @param string $before HTML output before the date. |
2567 * @param string $before HTML output before the date. |
2578 * @param string $after HTML output after the date. |
2568 * @param string $after HTML output after the date. |
|
2569 */ |
2579 */ |
2570 $the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after ); |
2580 $the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after ); |
2571 |
2581 |
2572 if ( $echo ) { |
2582 if ( $echo ) { |
2573 echo $the_modified_date; |
2583 echo $the_modified_date; |
2581 * Retrieve the date on which the post was last modified. |
2591 * Retrieve the date on which the post was last modified. |
2582 * |
2592 * |
2583 * @since 2.1.0 |
2593 * @since 2.1.0 |
2584 * @since 4.6.0 Added the `$post` parameter. |
2594 * @since 4.6.0 Added the `$post` parameter. |
2585 * |
2595 * |
2586 * @param string $format Optional. PHP date format defaults to the date_format option if not specified. |
2596 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. |
2587 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2597 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2588 * @return string|false Date the current post was modified. False on failure. |
2598 * @return string|int|false Date the current post was modified. False on failure. |
2589 */ |
2599 */ |
2590 function get_the_modified_date( $format = '', $post = null ) { |
2600 function get_the_modified_date( $format = '', $post = null ) { |
2591 $post = get_post( $post ); |
2601 $post = get_post( $post ); |
2592 |
2602 |
2593 if ( ! $post ) { |
2603 if ( ! $post ) { |
2603 * Filters the date a post was last modified. |
2613 * Filters the date a post was last modified. |
2604 * |
2614 * |
2605 * @since 2.1.0 |
2615 * @since 2.1.0 |
2606 * @since 4.6.0 Added the `$post` parameter. |
2616 * @since 4.6.0 Added the `$post` parameter. |
2607 * |
2617 * |
2608 * @param string|bool $the_time The formatted date or false if no post is found. |
2618 * @param string|int|false $the_time The formatted date or false if no post is found. |
2609 * @param string $format PHP date format. Defaults to value specified in |
2619 * @param string $format PHP date format. |
2610 * 'date_format' option. |
2620 * @param WP_Post|null $post WP_Post object or null if no post is found. |
2611 * @param WP_Post|null $post WP_Post object or null if no post is found. |
|
2612 */ |
2621 */ |
2613 return apply_filters( 'get_the_modified_date', $the_time, $format, $post ); |
2622 return apply_filters( 'get_the_modified_date', $the_time, $format, $post ); |
2614 } |
2623 } |
2615 |
2624 |
2616 /** |
2625 /** |
2617 * Display the time at which the post was written. |
2626 * Display the time at which the post was written. |
2618 * |
2627 * |
2619 * @since 0.71 |
2628 * @since 0.71 |
2620 * |
2629 * |
2621 * @param string $format Either 'G', 'U', or PHP date format. |
2630 * @param string $format Optional. Format to use for retrieving the time the post |
|
2631 * was written. Accepts 'G', 'U', or PHP date format. |
|
2632 * Defaults to the 'time_format' option. |
2622 */ |
2633 */ |
2623 function the_time( $format = '' ) { |
2634 function the_time( $format = '' ) { |
2624 /** |
2635 /** |
2625 * Filters the time a post was written for display. |
2636 * Filters the time a post was written for display. |
2626 * |
2637 * |
2627 * @since 0.71 |
2638 * @since 0.71 |
2628 * |
2639 * |
2629 * @param string $get_the_time The formatted time. |
2640 * @param string $get_the_time The formatted time. |
2630 * @param string $format The time format. Accepts 'G', 'U', |
2641 * @param string $format Format to use for retrieving the time the post |
2631 * or PHP date format. |
2642 * was written. Accepts 'G', 'U', or PHP date format. |
2632 */ |
2643 */ |
2633 echo apply_filters( 'the_time', get_the_time( $format ), $format ); |
2644 echo apply_filters( 'the_time', get_the_time( $format ), $format ); |
2634 } |
2645 } |
2635 |
2646 |
2636 /** |
2647 /** |
2637 * Retrieve the time at which the post was written. |
2648 * Retrieve the time at which the post was written. |
2638 * |
2649 * |
2639 * @since 1.5.0 |
2650 * @since 1.5.0 |
2640 * |
2651 * |
2641 * @param string $format Optional. Format to use for retrieving the time the post |
2652 * @param string $format Optional. Format to use for retrieving the time the post |
2642 * was written. Either 'G', 'U', or PHP date format defaults |
2653 * was written. Accepts 'G', 'U', or PHP date format. |
2643 * to the value specified in the time_format option. Default empty. |
2654 * Defaults to the 'time_format' option. |
2644 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object. |
2655 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object. |
2645 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2656 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2646 * False on failure. |
2657 * False on failure. |
2647 */ |
2658 */ |
2648 function get_the_time( $format = '', $post = null ) { |
2659 function get_the_time( $format = '', $post = null ) { |
2660 * Filters the time a post was written. |
2671 * Filters the time a post was written. |
2661 * |
2672 * |
2662 * @since 1.5.0 |
2673 * @since 1.5.0 |
2663 * |
2674 * |
2664 * @param string $the_time The formatted time. |
2675 * @param string $the_time The formatted time. |
2665 * @param string $format Format to use for retrieving the time the post was written. |
2676 * @param string $format Format to use for retrieving the time the post |
2666 * Accepts 'G', 'U', or PHP date format value specified |
2677 * was written. Accepts 'G', 'U', or PHP date format. |
2667 * in 'time_format' option. Default empty. |
|
2668 * @param int|WP_Post $post WP_Post object or ID. |
2678 * @param int|WP_Post $post WP_Post object or ID. |
2669 */ |
2679 */ |
2670 return apply_filters( 'get_the_time', $the_time, $format, $post ); |
2680 return apply_filters( 'get_the_time', $the_time, $format, $post ); |
2671 } |
2681 } |
2672 |
2682 |
2674 * Retrieve the time at which the post was written. |
2684 * Retrieve the time at which the post was written. |
2675 * |
2685 * |
2676 * @since 2.0.0 |
2686 * @since 2.0.0 |
2677 * |
2687 * |
2678 * @param string $format Optional. Format to use for retrieving the time the post |
2688 * @param string $format Optional. Format to use for retrieving the time the post |
2679 * was written. Either 'G', 'U', or PHP date format. Default 'U'. |
2689 * was written. Accepts 'G', 'U', or PHP date format. Default 'U'. |
2680 * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. |
2690 * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. |
2681 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object. |
2691 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object. |
2682 * @param bool $translate Whether to translate the time string. Default false. |
2692 * @param bool $translate Whether to translate the time string. Default false. |
2683 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2693 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2684 * False on failure. |
2694 * False on failure. |
2802 /** |
2812 /** |
2803 * Display the time at which the post was last modified. |
2813 * Display the time at which the post was last modified. |
2804 * |
2814 * |
2805 * @since 2.0.0 |
2815 * @since 2.0.0 |
2806 * |
2816 * |
2807 * @param string $format Optional. Either 'G', 'U', or PHP date format defaults |
2817 * @param string $format Optional. Format to use for retrieving the time the post |
2808 * to the value specified in the time_format option. |
2818 * was modified. Accepts 'G', 'U', or PHP date format. |
|
2819 * Defaults to the 'time_format' option. |
2809 */ |
2820 */ |
2810 function the_modified_time( $format = '' ) { |
2821 function the_modified_time( $format = '' ) { |
2811 /** |
2822 /** |
2812 * Filters the localized time a post was last modified, for display. |
2823 * Filters the localized time a post was last modified, for display. |
2813 * |
2824 * |
2814 * @since 2.0.0 |
2825 * @since 2.0.0 |
2815 * |
2826 * |
2816 * @param string $get_the_modified_time The formatted time. |
2827 * @param string|false $get_the_modified_time The formatted time or false if no post is found. |
2817 * @param string $format The time format. Accepts 'G', 'U', |
2828 * @param string $format Format to use for retrieving the time the post |
2818 * or PHP date format. Defaults to value |
2829 * was modified. Accepts 'G', 'U', or PHP date format. |
2819 * specified in 'time_format' option. |
|
2820 */ |
2830 */ |
2821 echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format ); |
2831 echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format ); |
2822 } |
2832 } |
2823 |
2833 |
2824 /** |
2834 /** |
2826 * |
2836 * |
2827 * @since 2.0.0 |
2837 * @since 2.0.0 |
2828 * @since 4.6.0 Added the `$post` parameter. |
2838 * @since 4.6.0 Added the `$post` parameter. |
2829 * |
2839 * |
2830 * @param string $format Optional. Format to use for retrieving the time the post |
2840 * @param string $format Optional. Format to use for retrieving the time the post |
2831 * was modified. Either 'G', 'U', or PHP date format defaults |
2841 * was modified. Accepts 'G', 'U', or PHP date format. |
2832 * to the value specified in the time_format option. Default empty. |
2842 * Defaults to the 'time_format' option. |
2833 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2843 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2834 * @return string|false Formatted date string or Unix timestamp. False on failure. |
2844 * @return string|int|false Formatted date string or Unix timestamp. False on failure. |
2835 */ |
2845 */ |
2836 function get_the_modified_time( $format = '', $post = null ) { |
2846 function get_the_modified_time( $format = '', $post = null ) { |
2837 $post = get_post( $post ); |
2847 $post = get_post( $post ); |
2838 |
2848 |
2839 if ( ! $post ) { |
2849 if ( ! $post ) { |
2849 * Filters the localized time a post was last modified. |
2859 * Filters the localized time a post was last modified. |
2850 * |
2860 * |
2851 * @since 2.0.0 |
2861 * @since 2.0.0 |
2852 * @since 4.6.0 Added the `$post` parameter. |
2862 * @since 4.6.0 Added the `$post` parameter. |
2853 * |
2863 * |
2854 * @param string|bool $the_time The formatted time or false if no post is found. |
2864 * @param string|int|false $the_time The formatted time or false if no post is found. |
2855 * @param string $format Format to use for retrieving the time the post was |
2865 * @param string $format Format to use for retrieving the time the post |
2856 * written. Accepts 'G', 'U', or PHP date format. Defaults |
2866 * was modified. Accepts 'G', 'U', or PHP date format. |
2857 * to value specified in 'time_format' option. |
2867 * @param WP_Post|null $post WP_Post object or null if no post is found. |
2858 * @param WP_Post|null $post WP_Post object or null if no post is found. |
|
2859 */ |
2868 */ |
2860 return apply_filters( 'get_the_modified_time', $the_time, $format, $post ); |
2869 return apply_filters( 'get_the_modified_time', $the_time, $format, $post ); |
2861 } |
2870 } |
2862 |
2871 |
2863 /** |
2872 /** |
2864 * Retrieve the time at which the post was last modified. |
2873 * Retrieve the time at which the post was last modified. |
2865 * |
2874 * |
2866 * @since 2.0.0 |
2875 * @since 2.0.0 |
2867 * |
2876 * |
2868 * @param string $format Optional. Format to use for retrieving the time the post |
2877 * @param string $format Optional. Format to use for retrieving the time the post |
2869 * was modified. Either 'G', 'U', or PHP date format. Default 'U'. |
2878 * was modified. Accepts 'G', 'U', or PHP date format. Default 'U'. |
2870 * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. |
2879 * @param bool $gmt Optional. Whether to retrieve the GMT time. Default false. |
2871 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object. |
2880 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object. |
2872 * @param bool $translate Whether to translate the time string. Default false. |
2881 * @param bool $translate Whether to translate the time string. Default false. |
2873 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2882 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2874 * False on failure. |
2883 * False on failure. |
2907 /** |
2916 /** |
2908 * Filters the localized time a post was last modified. |
2917 * Filters the localized time a post was last modified. |
2909 * |
2918 * |
2910 * @since 2.8.0 |
2919 * @since 2.8.0 |
2911 * |
2920 * |
2912 * @param string $time The formatted time. |
2921 * @param string|int $time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2913 * @param string $format Format to use for retrieving the time the post was modified. |
2922 * @param string $format Format to use for retrieving the time the post was modified. |
2914 * Accepts 'G', 'U', or PHP date format. Default 'U'. |
2923 * Accepts 'G', 'U', or PHP date format. Default 'U'. |
2915 * @param bool $gmt Whether to retrieve the GMT time. Default false. |
2924 * @param bool $gmt Whether to retrieve the GMT time. Default false. |
2916 */ |
2925 */ |
2917 return apply_filters( 'get_post_modified_time', $time, $format, $gmt ); |
2926 return apply_filters( 'get_post_modified_time', $time, $format, $gmt ); |
2918 } |
2927 } |
2919 |
2928 |
2920 /** |
2929 /** |
2955 * |
2964 * |
2956 * @global WP_Locale $wp_locale WordPress date and time locale object. |
2965 * @global WP_Locale $wp_locale WordPress date and time locale object. |
2957 * @global string $currentday The day of the current post in the loop. |
2966 * @global string $currentday The day of the current post in the loop. |
2958 * @global string $previousweekday The day of the previous post in the loop. |
2967 * @global string $previousweekday The day of the previous post in the loop. |
2959 * |
2968 * |
2960 * @param string $before Optional. Output before the date. |
2969 * @param string $before Optional. Output before the date. Default empty. |
2961 * @param string $after Optional. Output after the date. |
2970 * @param string $after Optional. Output after the date. Default empty. |
2962 */ |
2971 */ |
2963 function the_weekday_date( $before = '', $after = '' ) { |
2972 function the_weekday_date( $before = '', $after = '' ) { |
2964 global $wp_locale, $currentday, $previousweekday; |
2973 global $wp_locale, $currentday, $previousweekday; |
2965 |
2974 |
2966 $post = get_post(); |
2975 $post = get_post(); |
3151 $tax = get_taxonomy( $term->taxonomy ); |
3160 $tax = get_taxonomy( $term->taxonomy ); |
3152 $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name ); |
3161 $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name ); |
3153 $href = get_term_feed_link( $term->term_id, $term->taxonomy ); |
3162 $href = get_term_feed_link( $term->term_id, $term->taxonomy ); |
3154 } |
3163 } |
3155 } elseif ( is_author() ) { |
3164 } elseif ( is_author() ) { |
3156 $author_id = intval( get_query_var( 'author' ) ); |
3165 $author_id = (int) get_query_var( 'author' ); |
3157 |
3166 |
3158 $title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
3167 $title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
3159 $href = get_author_feed_link( $author_id ); |
3168 $href = get_author_feed_link( $author_id ); |
3160 } elseif ( is_search() ) { |
3169 } elseif ( is_search() ) { |
3161 $title = sprintf( $args['searchtitle'], get_bloginfo( 'name' ), $args['separator'], get_search_query( false ) ); |
3170 $title = sprintf( $args['searchtitle'], get_bloginfo( 'name' ), $args['separator'], get_search_query( false ) ); |
3186 function wlwmanifest_link() { |
3195 function wlwmanifest_link() { |
3187 echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="' . includes_url( 'wlwmanifest.xml' ) . '" /> ' . "\n"; |
3196 echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="' . includes_url( 'wlwmanifest.xml' ) . '" /> ' . "\n"; |
3188 } |
3197 } |
3189 |
3198 |
3190 /** |
3199 /** |
3191 * Displays a noindex meta tag if required by the blog configuration. |
3200 * Displays a referrer strict-origin-when-cross-origin meta tag. |
3192 * |
3201 * |
3193 * If a blog is marked as not being public then the noindex meta tag will be |
|
3194 * output to tell web robots not to index the page content. Add this to the |
|
3195 * {@see 'wp_head'} action. |
|
3196 * |
|
3197 * Typical usage is as a {@see 'wp_head'} callback: |
|
3198 * |
|
3199 * add_action( 'wp_head', 'noindex' ); |
|
3200 * |
|
3201 * @see wp_no_robots |
|
3202 * |
|
3203 * @since 2.1.0 |
|
3204 */ |
|
3205 function noindex() { |
|
3206 // If the blog is not public, tell robots to go away. |
|
3207 if ( '0' == get_option( 'blog_public' ) ) { |
|
3208 wp_no_robots(); |
|
3209 } |
|
3210 } |
|
3211 |
|
3212 /** |
|
3213 * Display a noindex meta tag. |
|
3214 * |
|
3215 * Outputs a noindex meta tag that tells web robots not to index the page content. |
|
3216 * Typical usage is as a {@see 'wp_head'} callback. add_action( 'wp_head', 'wp_no_robots' ); |
|
3217 * |
|
3218 * @since 3.3.0 |
|
3219 * @since 5.3.0 Echo "noindex,nofollow" if search engine visibility is discouraged. |
|
3220 */ |
|
3221 function wp_no_robots() { |
|
3222 if ( get_option( 'blog_public' ) ) { |
|
3223 echo "<meta name='robots' content='noindex,follow' />\n"; |
|
3224 return; |
|
3225 } |
|
3226 |
|
3227 echo "<meta name='robots' content='noindex,nofollow' />\n"; |
|
3228 } |
|
3229 |
|
3230 /** |
|
3231 * Display a noindex,noarchive meta tag and referrer origin-when-cross-origin meta tag. |
|
3232 * |
|
3233 * Outputs a noindex,noarchive meta tag that tells web robots not to index or cache the page content. |
|
3234 * Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full |
3202 * Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full |
3235 * url as a referrer to other sites when cross-origin assets are loaded. |
3203 * url as a referrer to other sites when cross-origin assets are loaded. |
3236 * |
3204 * |
3237 * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_sensitive_page_meta' ); |
3205 * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_strict_cross_origin_referrer' ); |
3238 * |
3206 * |
3239 * @since 5.0.1 |
3207 * @since 5.7.0 |
3240 */ |
3208 */ |
3241 function wp_sensitive_page_meta() { |
3209 function wp_strict_cross_origin_referrer() { |
3242 ?> |
3210 ?> |
3243 <meta name='robots' content='noindex,noarchive' /> |
|
3244 <meta name='referrer' content='strict-origin-when-cross-origin' /> |
3211 <meta name='referrer' content='strict-origin-when-cross-origin' /> |
3245 <?php |
3212 <?php |
3246 } |
3213 } |
3247 |
3214 |
3248 /** |
3215 /** |
3325 |
3292 |
3326 /** |
3293 /** |
3327 * Filters domains and URLs for resource hints of relation type. |
3294 * Filters domains and URLs for resource hints of relation type. |
3328 * |
3295 * |
3329 * @since 4.6.0 |
3296 * @since 4.6.0 |
|
3297 * @since 4.7.0 The `$urls` parameter accepts arrays of specific HTML attributes |
|
3298 * as its child elements. |
3330 * |
3299 * |
3331 * @param array $urls URLs to print for resource hints. |
3300 * @param array $urls { |
3332 * @param string $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'. |
3301 * Array of resources and their attributes, or URLs to print for resource hints. |
|
3302 * |
|
3303 * @type array|string ...$0 { |
|
3304 * Array of resource attributes, or a URL string. |
|
3305 * |
|
3306 * @type string $href URL to include in resource hints. Required. |
|
3307 * @type string $as How the browser should treat the resource |
|
3308 * (`script`, `style`, `image`, `document`, etc). |
|
3309 * @type string $crossorigin Indicates the CORS policy of the specified resource. |
|
3310 * @type float $pr Expected probability that the resource hint will be used. |
|
3311 * @type string $type Type of the resource (`text/html`, `text/css`, etc). |
|
3312 * } |
|
3313 * } |
|
3314 * @param string $relation_type The relation type the URLs are printed for, |
|
3315 * e.g. 'preconnect' or 'prerender'. |
3333 */ |
3316 */ |
3334 $urls = apply_filters( 'wp_resource_hints', $urls, $relation_type ); |
3317 $urls = apply_filters( 'wp_resource_hints', $urls, $relation_type ); |
3335 |
3318 |
3336 foreach ( $urls as $key => $url ) { |
3319 foreach ( $urls as $key => $url ) { |
3337 $atts = array(); |
3320 $atts = array(); |
3461 if ( ! isset( $wp_rich_edit ) ) { |
3444 if ( ! isset( $wp_rich_edit ) ) { |
3462 $wp_rich_edit = false; |
3445 $wp_rich_edit = false; |
3463 |
3446 |
3464 if ( 'true' === get_user_option( 'rich_editing' ) || ! is_user_logged_in() ) { // Default to 'true' for logged out users. |
3447 if ( 'true' === get_user_option( 'rich_editing' ) || ! is_user_logged_in() ) { // Default to 'true' for logged out users. |
3465 if ( $is_safari ) { |
3448 if ( $is_safari ) { |
3466 $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 ); |
3449 $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 ); |
3467 } elseif ( $is_IE ) { |
3450 } elseif ( $is_IE ) { |
3468 $wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false ); |
3451 $wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false ); |
3469 } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) { |
3452 } elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) { |
3470 $wp_rich_edit = true; |
3453 $wp_rich_edit = true; |
3471 } |
3454 } |
3571 * @type WP_Theme $theme Theme being edited when on theme editor. |
3554 * @type WP_Theme $theme Theme being edited when on theme editor. |
3572 * @type string $plugin Plugin being edited when on plugin editor. |
3555 * @type string $plugin Plugin being edited when on plugin editor. |
3573 * @type array $codemirror Additional CodeMirror setting overrides. |
3556 * @type array $codemirror Additional CodeMirror setting overrides. |
3574 * @type array $csslint CSSLint rule overrides. |
3557 * @type array $csslint CSSLint rule overrides. |
3575 * @type array $jshint JSHint rule overrides. |
3558 * @type array $jshint JSHint rule overrides. |
3576 * @type array $htmlhint JSHint rule overrides. |
3559 * @type array $htmlhint HTMLHint rule overrides. |
3577 * } |
3560 * } |
3578 * @return array|false Settings for the enqueued code editor, or false if the editor was not enqueued. |
3561 * @return array|false Settings for the enqueued code editor, or false if the editor was not enqueued. |
3579 */ |
3562 */ |
3580 function wp_enqueue_code_editor( $args ) { |
3563 function wp_enqueue_code_editor( $args ) { |
3581 if ( is_user_logged_in() && 'false' === wp_get_current_user()->syntax_highlighting ) { |
3564 if ( is_user_logged_in() && 'false' === wp_get_current_user()->syntax_highlighting ) { |
3662 * @type WP_Theme $theme Theme being edited when on theme editor. |
3645 * @type WP_Theme $theme Theme being edited when on theme editor. |
3663 * @type string $plugin Plugin being edited when on plugin editor. |
3646 * @type string $plugin Plugin being edited when on plugin editor. |
3664 * @type array $codemirror Additional CodeMirror setting overrides. |
3647 * @type array $codemirror Additional CodeMirror setting overrides. |
3665 * @type array $csslint CSSLint rule overrides. |
3648 * @type array $csslint CSSLint rule overrides. |
3666 * @type array $jshint JSHint rule overrides. |
3649 * @type array $jshint JSHint rule overrides. |
3667 * @type array $htmlhint JSHint rule overrides. |
3650 * @type array $htmlhint HTMLHint rule overrides. |
3668 * } |
3651 * } |
3669 * @return array|false Settings for the code editor. |
3652 * @return array|false Settings for the code editor. |
3670 */ |
3653 */ |
3671 function wp_get_code_editor_settings( $args ) { |
3654 function wp_get_code_editor_settings( $args ) { |
3672 $settings = array( |
3655 $settings = array( |
3999 * @type WP_Theme $theme Theme being edited when on theme editor. |
3982 * @type WP_Theme $theme Theme being edited when on theme editor. |
4000 * @type string $plugin Plugin being edited when on plugin editor. |
3983 * @type string $plugin Plugin being edited when on plugin editor. |
4001 * @type array $codemirror Additional CodeMirror setting overrides. |
3984 * @type array $codemirror Additional CodeMirror setting overrides. |
4002 * @type array $csslint CSSLint rule overrides. |
3985 * @type array $csslint CSSLint rule overrides. |
4003 * @type array $jshint JSHint rule overrides. |
3986 * @type array $jshint JSHint rule overrides. |
4004 * @type array $htmlhint JSHint rule overrides. |
3987 * @type array $htmlhint HTMLHint rule overrides. |
4005 * } |
3988 * } |
4006 */ |
3989 */ |
4007 return apply_filters( 'wp_code_editor_settings', $settings, $args ); |
3990 return apply_filters( 'wp_code_editor_settings', $settings, $args ); |
4008 } |
3991 } |
4009 |
3992 |
4110 function language_attributes( $doctype = 'html' ) { |
4093 function language_attributes( $doctype = 'html' ) { |
4111 echo get_language_attributes( $doctype ); |
4094 echo get_language_attributes( $doctype ); |
4112 } |
4095 } |
4113 |
4096 |
4114 /** |
4097 /** |
4115 * Retrieve paginated link for archive post pages. |
4098 * Retrieves paginated links for archive post pages. |
4116 * |
4099 * |
4117 * Technically, the function can be used to create paginated link list for any |
4100 * Technically, the function can be used to create paginated link list for any |
4118 * area. The 'base' argument is used to reference the url, which will be used to |
4101 * area. The 'base' argument is used to reference the url, which will be used to |
4119 * create the paginated links. The 'format' argument is then used for replacing |
4102 * create the paginated links. The 'format' argument is then used for replacing |
4120 * the page number. It is however, most likely and by default, to be used on the |
4103 * the page number. It is however, most likely and by default, to be used on the |
4197 $pagenum_link = html_entity_decode( get_pagenum_link() ); |
4180 $pagenum_link = html_entity_decode( get_pagenum_link() ); |
4198 $url_parts = explode( '?', $pagenum_link ); |
4181 $url_parts = explode( '?', $pagenum_link ); |
4199 |
4182 |
4200 // Get max pages and current page out of the current query, if available. |
4183 // Get max pages and current page out of the current query, if available. |
4201 $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; |
4184 $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; |
4202 $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; |
4185 $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; |
4203 |
4186 |
4204 // Append the format placeholder to the base URL. |
4187 // Append the format placeholder to the base URL. |
4205 $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; |
4188 $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; |
4206 |
4189 |
4207 // URL base depends on permalink settings. |
4190 // URL base depends on permalink settings. |
4347 case 'array': |
4330 case 'array': |
4348 return $page_links; |
4331 return $page_links; |
4349 |
4332 |
4350 case 'list': |
4333 case 'list': |
4351 $r .= "<ul class='page-numbers'>\n\t<li>"; |
4334 $r .= "<ul class='page-numbers'>\n\t<li>"; |
4352 $r .= join( "</li>\n\t<li>", $page_links ); |
4335 $r .= implode( "</li>\n\t<li>", $page_links ); |
4353 $r .= "</li>\n</ul>\n"; |
4336 $r .= "</li>\n</ul>\n"; |
4354 break; |
4337 break; |
4355 |
4338 |
4356 default: |
4339 default: |
4357 $r = join( "\n", $page_links ); |
4340 $r = implode( "\n", $page_links ); |
4358 break; |
4341 break; |
4359 } |
4342 } |
|
4343 |
|
4344 /** |
|
4345 * Filters the HTML output of paginated links for archives. |
|
4346 * |
|
4347 * @since 5.7.0 |
|
4348 * |
|
4349 * @param string $r HTML output. |
|
4350 * @param array $args An array of arguments. See paginate_links() |
|
4351 * for information on accepted arguments. |
|
4352 */ |
|
4353 $r = apply_filters( 'paginate_links_output', $r, $args ); |
4360 |
4354 |
4361 return $r; |
4355 return $r; |
4362 } |
4356 } |
4363 |
4357 |
4364 /** |
4358 /** |
4418 |
4412 |
4419 wp_admin_css_color( |
4413 wp_admin_css_color( |
4420 'fresh', |
4414 'fresh', |
4421 _x( 'Default', 'admin color scheme' ), |
4415 _x( 'Default', 'admin color scheme' ), |
4422 false, |
4416 false, |
4423 array( '#222', '#333', '#0073aa', '#00a0d2' ), |
4417 array( '#1d2327', '#2c3338', '#2271b1', '#72aee6' ), |
4424 array( |
4418 array( |
4425 'base' => '#a0a5aa', |
4419 'base' => '#a7aaad', |
4426 'focus' => '#00a0d2', |
4420 'focus' => '#72aee6', |
4427 'current' => '#fff', |
4421 'current' => '#fff', |
4428 ) |
4422 ) |
4429 ); |
4423 ); |
4430 |
4424 |
4431 wp_admin_css_color( |
4425 wp_admin_css_color( |
4745 /** |
4739 /** |
4746 * Filters the HTML for the retrieved generator type. |
4740 * Filters the HTML for the retrieved generator type. |
4747 * |
4741 * |
4748 * The dynamic portion of the hook name, `$type`, refers to the generator type. |
4742 * The dynamic portion of the hook name, `$type`, refers to the generator type. |
4749 * |
4743 * |
|
4744 * Possible hook names include: |
|
4745 * |
|
4746 * - `get_the_generator_atom` |
|
4747 * - `get_the_generator_comment` |
|
4748 * - `get_the_generator_export` |
|
4749 * - `get_the_generator_html` |
|
4750 * - `get_the_generator_rdf` |
|
4751 * - `get_the_generator_rss2` |
|
4752 * - `get_the_generator_xhtml` |
|
4753 * |
4750 * @since 2.5.0 |
4754 * @since 2.5.0 |
4751 * |
4755 * |
4752 * @param string $gen The HTML markup output to wp_head(). |
4756 * @param string $gen The HTML markup output to wp_head(). |
4753 * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom', |
4757 * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom', |
4754 * 'rss2', 'rdf', 'comment', 'export'. |
4758 * 'rss2', 'rdf', 'comment', 'export'. |