WordPress.org

Make WordPress Core

Ticket #17017: patch.diff

File patch.diff, 1.0 KB (added by wiltave, 3 years ago)
Line 
1# This patch file was generated by NetBeans IDE
2# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
3# It uses platform neutral UTF-8 encoding.
4# Above lines and this line are ignored by the patching process.
55239,5267d5238
6< /**
7<  * Check if post has a featured image
8<  * @access public
9<  * @since 3.1.0
10<  * @param integer post_id.
11<  * @return boolean
12<  */
13< function has_featured_image( $post_id ) {
14<     return get_post_meta( $post_id, '_thumbnail_id', true ) ? true : false;
15< }
16<
17< /**
18<  * Get featured image url
19<  * @access public
20<  * @since 3.1.0
21<  * @param integer post_id.
22<  * @return string|null featured image url.
23<  */
24< function get_featured_image_url( $post_id ) {
25<     $featured_image_url = null;
26<
27<     if ( has_featured_image( $post_id ) ) {
28<         $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
29<         $featured_image_url = 'wp-content/uploads/' .
30<             get_post_meta( $thumbnail_id, '_wp_attached_file', true );
31<     }
32<
33<     return  $featured_image_url;
34< }