From 8d8a7c3c92df9101424551761a1bb390a55ca0c2 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Wed, 18 Dec 2013 20:22:06 +0000 Subject: [PATCH] Open Graph: add `published_time`, `modified_time`, and `author` Props @niallkennedy For more details, see the original ticket: http://plugins.trac.wordpress.org/ticket/1881 --- functions.opengraph.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions.opengraph.php b/functions.opengraph.php index bed487ef0c0cc..ac5c07423022b 100644 --- a/functions.opengraph.php +++ b/functions.opengraph.php @@ -64,6 +64,10 @@ function jetpack_og_tags() { if ( !post_password_required() ) $tags['og:description'] = ! empty( $data->post_excerpt ) ? preg_replace( '@https?://[\S]+@', '', strip_shortcodes( wp_kses( $data->post_excerpt, array() ) ) ): wp_trim_words( preg_replace( '@https?://[\S]+@', '', strip_shortcodes( wp_kses( $data->post_content, array() ) ) ) ); $tags['og:description'] = empty( $tags['og:description'] ) ? ' ' : $tags['og:description']; + $tags['article:published_time'] = date( 'c', strtotime( $data->post_date_gmt ) ); + $tags['article:modified_time'] = date( 'c', strtotime( $data->post_modified_gmt ) ); + if ( post_type_supports( get_post_type( $data ), 'author' ) && isset( $data->post_author ) ) + $tags['article:author'] = get_author_posts_url( $data->post_author ); } // Re-enable widont if we had disabled it @@ -220,4 +224,4 @@ function jetpack_og_get_image_gravatar( $email, $width ) { } return $image; -} \ No newline at end of file +}