Support » Theme: OceanWP » Alt Tags of Featured Image in single posts taking post title name

  • Resolved Dibakash Baruah

    (@dibakash)


    I am using the OceanWP theme. In single posts, I have enabled display featured image as well featured image as a title background. Till then everything is fine.

    Now, when I do inspect element in browser I see that the alt tag of the post featured images is set to post title, which exactly I don’t want. I have set the Alt tag in the image alt tag option in WordPress edit image option but instead of the alt tag that I have set the alt tag is set to post title.

    PS: this issue is prominent in ocean wp but when I switch to default theme the alt tag is back to what I have set.

Viewing 6 replies - 1 through 6 (of 6 total)
  • [1]: https://i.stack.imgur.com/Ly9CS.png
    [2]: https://i.stack.imgur.com/0gHAY.png

    what is the solution for Featured images to have the alt tag that I have set in WordPress and not the post title as alt tag.

    Hello,

    1. Install and activate the oceanwp child theme
    2. Copy the oceanwp > partials > single > media > blog-single.php file into the child theme
    3. Open the copied file and edit the code as per your need. Line 32-34. See the below code that need to be edited/removed –

    $img_args = array(
        'alt' => get_the_title(),
    );

    Thank you so much!

    Your Solution Works like a charm. Really appreciate the quick response.

    Also, applied the same logic under Partials>entry>media>blog-entry.php

    Now my original alt tags show up at single post featured image and blog entries thumbnails as well.

    But there is one more thing. I tried to figure out without success for related posts ( next previous post under single posts) alt tags. For these, the alt tags are still set to post title. Can you please help me out with these as well.

    Also,

    I have directly edited ( commented out the suggested php codes in line near 32/34 etc with “//”) in main theme and not child theme. Will it effect anyway?

    Hello,

    Try to edit the related post template as well to change the alt tag.
    Try to edit the file using the child theme else it will be erased after the theme update.

    Thanks. Issue resolved. By the way, Tried to contact you on Slack without any success. I Need a mentor.

    Thanks a lot by the way.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.