• mikedini

    (@mikedini)


    I no longer get the title attribute when I upload an image to WP2.0. I put descriptive text into the “title” field, but all I get is alt=”my descriptive text here.” I know that it was working previously, and I don’t believe that I’ve changed anything. Help!

    https://www.pistolotto.com

Viewing 7 replies - 1 through 7 (of 7 total)
  • pratian

    (@pratian)

    I have the same problem. WordPress is calling up the title text for the alt text. The “title” as entered into the inline image uploader is entered into the MySQL database as a post_title, the “description” field enters it a post_content. However, in the end the both the title and alt attributes’ text are being called from the post_title.

    I’m not sure where this glitch is to be found. I need to change it so the description is displayed as alt text.

    You have to edit inline-uploading.php (in your wp-admin folder). Go to around line 251, and find the line that says

    <img id=\"image{$ID}\" src=\"$src\" alt=\"{$title}\" $height_width />

    Change this line to

    <img id=\"image{$ID}\" src=\"$src\" alt=\"{$descr}\" title=\"{$title}\" $height_width />

    This should take effect the next time you upload something. Unfortunately, the change won’t apply to anything you’ve already uploaded, because the HTML is already stored in your database.

    Sorry, please disregard my first post. I actually had to change a lot of other things in inline-uploading.php to get it to work properly. Here are all the changes.

    Line 143:
    $attachments = $wpdb->get_results("SELECT ID, post_date, post_title,
    Add post_content to the list between post_date and post_title.

    Line 243:
    Find the line
    $title = wp_specialchars($image['post_title'], ENT_QUOTES);
    After this line, add the following line:
    $descr = wp_specialchars($image['post_content'], ENT_QUOTES);

    Around line 247:
    Make this change for the two lines that begin with imga[{$ID}] and with imgb[{$ID}]. Replace alt=\"{$title}\", with alt=\"{$descr}\" title=\"{$title}\" or whatever change you wanted to make.

    Around line 252:
    Make the same change as above. It should look like
    <div id='div{$ID}' class='imagewrap' onclick=\"doPopup({$ID});\">
    <img id=\"image{$ID}\" src=\"$src\" alt=\"{$descr}\" title=\"{$title}\" $height_width />
    </div>

    sketchbunny: I’m applying this patch right now. Thank you for sharing it.

    And yes, it worked fine with WP 2.0.5

    Thanks again.

    sketchbunny

    Thanks, that was perfect.

    And now that I’m using 2.1 I’m back to square one. I’ll see if I can make a similar tweak to above but if anyone has done this already, please feel free to share.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Title attribute missing’ is closed to new replies.