Changeset 10161 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
- Timestamp:
- 08/13/2020 05:43:27 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
r10150 r10161 255 255 return $wp_users; 256 256 } 257 258 /** 259 * Display a featured image, falling back to the VideoPress thumbnail if no featured image was explicitly set. 260 * 261 * @param $post The Workshop post for which we want the thumbnail. 262 * @param $size The image size: 'medium', 'full'. 263 */ 264 function wporg_get_post_thumbnail( $post, $size = 'post-thumbnail' ) { 265 $thumbnail = get_the_post_thumbnail( $post, $size ); 266 if ( $thumbnail ) { 267 return $thumbnail; 268 } else { 269 $post = get_post( $post ); 270 foreach ( get_post_meta( $post->ID, '', true ) as $key => $value ) { 271 if ( substr( $key, 0, 8 ) === '_oembed_' && preg_match( '#https://video.wordpress.com/embed/(\w+)#', $value[0], $match ) ) { 272 $video = videopress_get_video_details( $match[1] ); 273 if ( !is_wp_error( $video ) && isset( $video->poster ) ) { 274 return '<img class="attachment-' . esc_attr( $size ) . ' wp-post-image" src=' . esc_url( $video->poster ) . ' loading="lazy" />'; 275 } 276 } 277 } 278 } 279 } 280
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)