[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
WordPress Post Thumbnail Template Functions. Support for post thumbnails. Theme's functions.php must call add_theme_support( 'post-thumbnails' ) to use these.
File Size: | 325 lines (11 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
has_post_thumbnail( $post = null ) X-Ref |
Determines whether a post has an image attached. For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook. return: bool Whether the post has an image attached. since: 2.9.0 since: 4.4.0 `$post` can be a post ID or WP_Post object. param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. |
get_post_thumbnail_id( $post = null ) X-Ref |
Retrieves the post thumbnail ID. return: int|false Post thumbnail ID (which can be 0 if the thumbnail is not set), since: 2.9.0 since: 4.4.0 `$post` can be a post ID or WP_Post object. since: 5.5.0 The return value for a non-existing post param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. |
the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) X-Ref |
Displays the post thumbnail. When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' image size is registered, which differs from the 'thumbnail' image size managed via the Settings > Media screen. When using the_post_thumbnail() or related functions, the 'post-thumbnail' image size is used by default, though a different size can be specified instead as needed. since: 2.9.0 param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of param: string|array $attr Optional. Query string or array of attributes. Default empty. |
update_post_thumbnail_cache( $wp_query = null ) X-Ref |
Updates cache for thumbnails in the current loop. since: 3.2.0 param: WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global. |
get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr = '' ) X-Ref |
Retrieves the post thumbnail. When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' image size is registered, which differs from the 'thumbnail' image size managed via the Settings > Media screen. When using the_post_thumbnail() or related functions, the 'post-thumbnail' image size is used by default, though a different size can be specified instead as needed. return: string The post thumbnail image tag. since: 2.9.0 since: 4.4.0 `$post` can be a post ID or WP_Post object. param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. param: string|int[] $size Optional. Image size. Accepts any registered image size name, or an array of param: string|array $attr Optional. Query string or array of attributes. Default empty. |
get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) X-Ref |
Returns the post thumbnail URL. return: string|false Post thumbnail URL or false if no image is available. If `$size` does not match since: 4.4.0 param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. param: string|int[] $size Optional. Registered image size to retrieve the source for or a flat array |
the_post_thumbnail_url( $size = 'post-thumbnail' ) X-Ref |
Displays the post thumbnail URL. since: 4.4.0 param: string|int[] $size Optional. Image size to use. Accepts any valid image size, |
get_the_post_thumbnail_caption( $post = null ) X-Ref |
Returns the post thumbnail caption. return: string Post thumbnail caption. since: 4.6.0 param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. |
the_post_thumbnail_caption( $post = null ) X-Ref |
Displays the post thumbnail caption. since: 4.6.0 param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. |
Generated: Tue Dec 24 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |