WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #30144, comment 3


Ignore:
Timestamp:
11/13/2014 08:38:06 PM (6 years ago)
Author:
hiwhatsup
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30144, comment 3

    initial v1  
    1 
    21{{{
    32the_post_thumbnail( 'post-thumbnail', array( 'alt'=>get_the_title() ) );
    43}}}
    54
    6 The parameter {{{post-thumbnail}}} seems redundant as {{{post-thumbnail}}} is the default value for size parameter of function {{{the_post_thumbnail()}}}.   And second defined parameter overrides the default value for image {{{alt}}} of  {{{ 'alt'   => trim( strip_tags( $wp_postmeta->_wp_attachment_image_alt ) ) }}}.  
     5The parameter {{{post-thumbnail}}} seems redundant as {{{post-thumbnail}}} is the default value for size parameter of function {{{the_post_thumbnail()}}}.   And second defined parameter overrides the default value for image {{{alt}}} which either returns the attachment except and if empty the attachment title: 
    76
    8 Is there a reason for returning the post title in place of the image alt value for the image {{{alt}}}?
     7In function {{{wp_get_attachment_image()}}} on line 710 if wp-includes/media.php
     8{{{
     9 if ( empty($default_attr['alt']) )
     10         $default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption
     11          if ( empty($default_attr['alt']) )
     12                  $default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title
     13
     14 }}} 
     15
     16Is there a reason for returning the post title in place of the attachment except or title for that image {{{alt}}}?