X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0459461f9ea42e0b090759ff6fe5f48360bef750..refs/tags/wordpress-4.5:/wp-includes/post-template.php diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 3164509b..a441d742 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -161,17 +161,22 @@ function get_the_title( $post = 0 ) { /** * Display the Post Global Unique Identifier (guid). * - * The guid will appear to be a link, but should not be used as an link to the + * The guid will appear to be a link, but should not be used as a link to the * post. The reason you should not use it as a link, is because of moving the * blog across domains. * - * Url is escaped to make it xml safe + * URL is escaped to make it XML-safe. * * @since 1.5.0 * - * @param int|WP_Post $id Optional. Post ID or post object. + * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post. */ -function the_guid( $id = 0 ) { +function the_guid( $post = 0 ) { + $post = get_post( $post ); + + $guid = isset( $post->guid ) ? get_the_guid( $post ) : ''; + $id = isset( $post->ID ) ? $post->ID : 0; + /** * Filter the escaped Global Unique Identifier (guid) of the post. * @@ -179,9 +184,10 @@ function the_guid( $id = 0 ) { * * @see get_the_guid() * - * @param string $post_guid Escaped Global Unique Identifier (guid) of the post. + * @param string $guid Escaped Global Unique Identifier (guid) of the post. + * @param int $id The post ID. */ - echo apply_filters( 'the_guid', get_the_guid( $id ) ); + echo apply_filters( 'the_guid', $guid, $id ); } /** @@ -193,20 +199,24 @@ function the_guid( $id = 0 ) { * * @since 1.5.0 * - * @param int|WP_Post $id Optional. Post ID or post object. + * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post. * @return string */ -function get_the_guid( $id = 0 ) { - $post = get_post($id); +function get_the_guid( $post = 0 ) { + $post = get_post( $post ); + + $guid = isset( $post->guid ) ? $post->guid : ''; + $id = isset( $post->ID ) ? $post->ID : 0; /** * Filter the Global Unique Identifier (guid) of the post. * * @since 1.5.0 * - * @param string $post_guid Global Unique Identifier (guid) of the post. + * @param string $guid Global Unique Identifier (guid) of the post. + * @param int $id The post ID. */ - return apply_filters( 'get_the_guid', $post->guid ); + return apply_filters( 'get_the_guid', $guid, $id ); } /** @@ -344,23 +354,25 @@ function the_excerpt() { } /** - * Retrieve the post excerpt. + * Retrieves the post excerpt. * * @since 0.71 + * @since 4.5.0 Introduced the `$post` parameter. * - * @param mixed $deprecated Not used. - * @return string + * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. + * @return string Post excerpt. */ -function get_the_excerpt( $deprecated = '' ) { - if ( !empty( $deprecated ) ) +function get_the_excerpt( $post = null ) { + if ( is_bool( $post ) ) { _deprecated_argument( __FUNCTION__, '2.3' ); + } - $post = get_post(); + $post = get_post( $post ); if ( empty( $post ) ) { return ''; } - if ( post_password_required() ) { + if ( post_password_required( $post ) ) { return __( 'There is no excerpt because this is a protected post.' ); } @@ -368,10 +380,12 @@ function get_the_excerpt( $deprecated = '' ) { * Filter the retrieved post excerpt. * * @since 1.2.0 + * @since 4.5.0 Introduced the `$post` parameter. * * @param string $post_excerpt The post excerpt. + * @param WP_Post $post Post object. */ - return apply_filters( 'get_the_excerpt', $post->post_excerpt ); + return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); } /** @@ -568,6 +582,9 @@ function get_body_class( $class = '' ) { $classes[] = 'attachment'; if ( is_404() ) $classes[] = 'error404'; + if ( is_singular() ) { + $classes[] = 'singular'; + } if ( is_single() ) { $post_id = $wp_query->get_queried_object_id(); @@ -689,6 +706,10 @@ function get_body_class( $class = '' ) { if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) $classes[] = 'custom-background'; + if ( has_custom_logo() ) { + $classes[] = 'wp-custom-logo'; + } + $page = $wp_query->get( 'page' ); if ( ! $page || $page < 2 ) @@ -1515,7 +1536,7 @@ function get_the_password_form( $post = 0 ) { $label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID ); $output = '

' . __( 'This content is password protected. To view it please enter your password below:' ) . '

-

+

'; /**