~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-includes/post-thumbnail-template.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:49:28 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: barry.price@canonical.com-20160817044928-viijiwb4tl8jwzmp
new upstream release 4.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
        $post_thumbnail_id = get_post_thumbnail_id( $post );
120
120
 
121
121
        /**
122
 
         * Filter the post thumbnail size.
 
122
         * Filters the post thumbnail size.
123
123
         *
124
124
         * @since 2.9.0
125
125
         *
163
163
                $html = '';
164
164
        }
165
165
        /**
166
 
         * Filter the post thumbnail HTML.
 
166
         * Filters the post thumbnail HTML.
167
167
         *
168
168
         * @since 2.9.0
169
169
         *
210
210
                echo esc_url( $url );
211
211
        }
212
212
}
 
213
 
 
214
/**
 
215
 * Returns the post thumbnail caption.
 
216
 *
 
217
 * @since 4.6.0
 
218
 *
 
219
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
 
220
 * @return string Post thumbnail caption.
 
221
 */
 
222
function get_the_post_thumbnail_caption( $post = null ) {
 
223
        $post_thumbnail_id = get_post_thumbnail_id( $post );
 
224
        if ( ! $post_thumbnail_id ) {
 
225
                return '';
 
226
        }
 
227
 
 
228
        $caption = wp_get_attachment_caption( $post_thumbnail_id );
 
229
 
 
230
        if ( ! $caption ) {
 
231
                $caption = '';
 
232
        }
 
233
 
 
234
        return $caption;
 
235
}
 
236
 
 
237
/**
 
238
 * Displays the post thumbnail caption.
 
239
 *
 
240
 * @since 4.6.0
 
241
 *
 
242
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
 
243
 */
 
244
function the_post_thumbnail_caption( $post = null ) {
 
245
        /**
 
246
         * Filters the displayed post thumbnail caption.
 
247
         *
 
248
         * @since 4.6.0
 
249
         *
 
250
         * @param string $caption Caption for the given attachment.
 
251
         */
 
252
        echo apply_filters( 'the_post_thumbnail_caption', get_the_post_thumbnail_caption( $post ) );
 
253
}