[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> post-thumbnail-template.php (summary)

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: 329 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 9 functions

  has_post_thumbnail()
  get_post_thumbnail_id()
  the_post_thumbnail()
  update_post_thumbnail_cache()
  get_the_post_thumbnail()
  get_the_post_thumbnail_url()
  the_post_thumbnail_url()
  get_the_post_thumbnail_caption()
  the_post_thumbnail_caption()

Functions
Functions that are not part of a class:

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.
param: int|WP_Post|null $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),
param: int|WP_Post|null $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.

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.

param: WP_Query|null $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.
param: int|WP_Post|null $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
param: int|WP_Post|null $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.

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.
param: int|WP_Post|null $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.

param: int|WP_Post|null $post Optional. Post ID or WP_Post object. Default is global `$post`.



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref