_wp_post_thumbnail_class_filter

Adds a 'wp-post-image' class to post thumbnails.

Description

(array) _wp_post_thumbnail_class_filter( (array) $attr ); 

Internal use only.

Uses the and action hooks to dynamically add/remove itself so as to only filter post thumbnails.

Returns (array)

Modified array of attributes including the new 'wp-post-image' class.

Parameters (1)

0. $attr (array)
Thumbnail attributes including src, class, alt, title.

Usage

  1. if ( !function_exists( '_wp_post_thumbnail_class_filter' ) ) { 
  2. require_once ABSPATH . WPINC . '/media.php'; 
  3.  
  4. // Thumbnail attributes including src, class, alt, title. 
  5. $attr = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _wp_post_thumbnail_class_filter($attr); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/media.php  
  1. function _wp_post_thumbnail_class_filter( $attr ) { 
  2. $attr['class'] .= ' wp-post-image'; 
  3. return $attr;