WordPress.org

Ready to get started?Download WordPress

Forums

the_post_thumbnail and ALT tag (2 posts)

  1. hemachandran
    Member
    Posted 5 years ago #

    Hi All,
    Can anyone clarify on ALT tag display?

    I've read various tuts available on net but still can't figure out why Alt tag is not displayed by default.

    Here is my code
    the_post_thumbnail(array(180,90), array( "class" => "alignleft post_thumbnail"));

    Above code shows title tag but doesn't show ALT tag, it shows alt=""

    When I use following code
    the_post_thumbnail(array(180,90), array( 'alt' => 'alttext', 'title' => 'titletext', "class" => "alignleft post_thumbnail"));

    I get alt="alttext"

    Anyone to solve this?

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 5 years ago #

    array( 'alt' => 'alttext',

    right here...you are specifying that alt reads 'alttext'

    so the output you are getting is exactly correct? It's what you told it to output...What are you wanting?

    with the post_thumbnail, I believe, title is automatically set....from the wording when you insert the picture

    unless you do this (your second example)
    'title' => 'titletext', which would override the default title and instead make it 'titletext'...exactly what you tell it!

Topic Closed

This topic has been closed to new replies.

About this Topic