WordPress.org

Forums

Restore Image Title
title tag in featured image (13 posts)

  1. fson
    Member
    Posted 2 years ago #

    hi,

    the title attribute does not restore in featured images or? do you know the solution for this ? is this possible?

    http://wordpress.org/extend/plugins/restore-image-title/

  2. Les Bessant
    Moderator and keeper of the Tiggers
    Plugin Author

    Posted 2 years ago #

    It'll probably be a similar solution.

    I'll have a look at the weekend when I should have some time to play.

  3. fson
    Member
    Posted 2 years ago #

    thanks! this would be so great!

  4. joschaa
    Member
    Posted 2 years ago #

    I would be very grateful if you'd provide a solution for that, I have the same problem!

  5. communicationcommon
    Member
    Posted 1 year ago #

    Hi there, I've just installed the Restore Image Title plugin on our WP 3.5.1 site and have the same problem, it works great for normal images, but doesn't work for featured images.

    Did you have any luck with a fix Les?

    Thanks!

  6. Les Bessant
    Moderator and keeper of the Tiggers
    Plugin Author

    Posted 1 year ago #

    Aha! The weekend with more time didn't show up.

    I'll have a play with featured images on my test site and see what I can come up with.

  7. communicationcommon
    Member
    Posted 1 year ago #

    Great, thanks!

  8. 0be1
    Member
    Posted 1 year ago #

    I just found this from another site and it works for my featured images. You may want to see if this will work in your plugin as well. Mine was theme related to the functions.php file so I copied and pasted the following code after the last line.

    add_filter('wp_get_attachment_image_attributes', 'my_img_title', 10, 2);
    function my_img_title($attr, $attachment = null){
    $attr['title'] = get_post($attachment->ID)->post_title;
    return $attr;
    }

    Hopefully this will help resolve the issue for many, and certainly there has to be a better way of handling the image titles other than just turning it off. I needed it BADLY as my pages have books on them and could not tell what the book title was without the captions.

    Thanks for all your hard work to getting this working again :o)

  9. communicationcommon
    Member
    Posted 1 year ago #

    Hi 0be1, pasting that code into the functions.php did the trick, many thanks!

    I'm no PHP coder, so I don't understand how it works exactly, but if anyone needs basic steps here's what I did:

    1) Find functions.php in wp-content/themes/my-theme-name
    2) Make a back-up of the file first in case you screw it up.
    3) Add the code provided by 0be1 above at the end, before the closing PHP tag ?>
    4) Upload the amended file and see if it works!

    Thanks again!

  10. micharhodes
    Member
    Posted 1 year ago #

    Thank you! I was having the hardest time trying to include the title in portfolio slideshow. This snippet worked perfectly.

  11. Addy R Singh
    Member
    Posted 1 year ago #

    I think there is a problem when you are working using a parent-child theme structure.The titles for images should come by default once given in the media but we have to add a filter, don't know why that is.

    Anyways, the code snippet by Obe1 works perfectly when pasted in functions.php file. Thanks!

  12. beggers
    Member
    Posted 1 year ago #

    When I noticed that Les' plugin stopped working I found this post and tried adding the above snippet of code to my theme's functions.php but it didn't help. However, let me point out that I don't use Featured Images but it doesn't work on normal images anymore, either.

    Bottom line is that I hope Les checks this out and gives us an upgrade. Thanks.

  13. esmi
    Forum Moderator
    Posted 1 year ago #

    @beggers: If you require assistance then, as per the Forum Welcome, please post your own topic. This topic references an old version of WordPress.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic