Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Les Bessant

    (@lesbessant)

    It’ll probably be a similar solution.

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

    Thread Starter fson

    (@fson)

    thanks! this would be so great!

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

    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!

    Plugin Author Les Bessant

    (@lesbessant)

    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.

    Great, thanks!

    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)

    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!

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

    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!

    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.

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

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘title tag in featured image’ is closed to new replies.