@@ 505-545 (lines=41) @@ | ||
502 | 'dont_email_post_to_subs' => get_post_meta( $post_obj->ID, '_jetpack_dont_email_post_to_subs', true ), |
|
503 | ); |
|
504 | ||
505 | if ( $fid = get_post_thumbnail_id( $id ) ) { |
|
506 | $feature = wp_get_attachment_image_src( $fid, 'large' ); |
|
507 | if ( ! empty( $feature[0] ) ) { |
|
508 | $post['extra']['featured_image'] = $feature[0]; |
|
509 | } |
|
510 | ||
511 | $attachment = get_post( $fid ); |
|
512 | if ( ! empty( $attachment ) ) { |
|
513 | $metadata = wp_get_attachment_metadata( $fid ); |
|
514 | ||
515 | $post['extra']['post_thumbnail'] = array( |
|
516 | 'ID' => (int) $fid, |
|
517 | 'URL' => (string) wp_get_attachment_url( $fid ), |
|
518 | 'guid' => (string) $attachment->guid, |
|
519 | 'mime_type' => (string) $attachment->post_mime_type, |
|
520 | 'width' => (int) isset( $metadata['width'] ) ? $metadata['width'] : 0, |
|
521 | 'height' => (int) isset( $metadata['height'] ) ? $metadata['height'] : 0, |
|
522 | ); |
|
523 | ||
524 | if ( isset( $metadata['duration'] ) ) { |
|
525 | $post['extra']['post_thumbnail'] = (int) $metadata['duration']; |
|
526 | } |
|
527 | ||
528 | /** |
|
529 | * Filters the Post Thumbnail information returned for a specific post. |
|
530 | * |
|
531 | * @since 3.3.0 |
|
532 | * |
|
533 | * @param array $post['extra']['post_thumbnail'] { |
|
534 | * Array of details about the Post Thumbnail. |
|
535 | * @param int ID Post Thumbnail ID. |
|
536 | * @param string URL Post thumbnail URL. |
|
537 | * @param string guid Post thumbnail guid. |
|
538 | * @param string mime_type Post thumbnail mime type. |
|
539 | * @param int width Post thumbnail width. |
|
540 | * @param int height Post thumbnail height. |
|
541 | * } |
|
542 | */ |
|
543 | $post['extra']['post_thumbnail'] = (object) apply_filters( 'get_attachment', $post['extra']['post_thumbnail'] ); |
|
544 | } |
|
545 | } |
|
546 | ||
547 | $post['permalink'] = get_permalink( $post_obj->ID ); |
|
548 | $post['shortlink'] = wp_get_shortlink( $post_obj->ID ); |
@@ 144-184 (lines=41) @@ | ||
141 | 'dont_email_post_to_subs' => get_post_meta( $post_obj->ID, '_jetpack_dont_email_post_to_subs', true ), |
|
142 | ); |
|
143 | ||
144 | if ( $attachment_id = get_post_thumbnail_id( $post_id ) ) { |
|
145 | $feature = wp_get_attachment_image_src( $attachment_id, 'large' ); |
|
146 | if ( ! empty( $feature[0] ) ) { |
|
147 | $post['extra']['featured_image'] = $feature[0]; |
|
148 | } |
|
149 | ||
150 | $attachment = get_post( $attachment_id ); |
|
151 | if ( ! empty( $attachment ) ) { |
|
152 | $metadata = wp_get_attachment_metadata( $attachment_id ); |
|
153 | ||
154 | $post['extra']['post_thumbnail'] = array( |
|
155 | 'ID' => (int) $attachment_id, |
|
156 | 'URL' => (string) wp_get_attachment_url( $attachment_id ), |
|
157 | 'guid' => (string) $attachment->guid, |
|
158 | 'mime_type' => (string) $attachment->post_mime_type, |
|
159 | 'width' => (int) isset( $metadata['width'] ) ? $metadata['width'] : 0, |
|
160 | 'height' => (int) isset( $metadata['height'] ) ? $metadata['height'] : 0, |
|
161 | ); |
|
162 | ||
163 | if ( isset( $metadata['duration'] ) ) { |
|
164 | $post['extra']['post_thumbnail'] = (int) $metadata['duration']; |
|
165 | } |
|
166 | ||
167 | /** |
|
168 | * Filters the Post Thumbnail information returned for a specific post. |
|
169 | * |
|
170 | * @since 3.3.0 |
|
171 | * |
|
172 | * @param array $post ['extra']['post_thumbnail'] { |
|
173 | * Array of details about the Post Thumbnail. |
|
174 | * @param int ID Post Thumbnail ID. |
|
175 | * @param string URL Post thumbnail URL. |
|
176 | * @param string guid Post thumbnail guid. |
|
177 | * @param string mime_type Post thumbnail mime type. |
|
178 | * @param int width Post thumbnail width. |
|
179 | * @param int height Post thumbnail height. |
|
180 | * } |
|
181 | */ |
|
182 | $post['extra']['post_thumbnail'] = (object) apply_filters( 'get_attachment', $post['extra']['post_thumbnail'] ); |
|
183 | } |
|
184 | } |
|
185 | ||
186 | $post['permalink'] = get_permalink( $post_obj->ID ); |
|
187 | $post['shortlink'] = wp_get_shortlink( $post_obj->ID ); |