Tagged: , ,

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
  • #1181


    most all the photos in the home page and all in the portfolio page are without the alt atribute. If you see the code, it is something like

    <img src='http://www.webpage.com/wp-content/uploads/2010/09/nutricion-saludable-200x130.jpg' alt='' title='Nutrición saludable' />

    Could you please me help to get this atribute and add it in each image? Thank you for your support.


    I have just made one change and it is almost working:

    - In the file kriesi_post_thumb.php , I added the code


    in line 167

    $defaultimage = $linkwrap[0]."<img src='".$image_URL."' alt='".get_the_title()."' title='".get_the_title()."' />".$linkwrap[1];

    How I can get the alt atribute of an image? Is there a function for this?


    Thank you Dude, but it does not work. The alt attribute is empty when i write alt='”.$alt.”‘

    I will try to copy the code.

    $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
    if(count($alt)) echo $alt;

    $defaultimage = $linkwrap[0]."<img ".$img_attr_string." src='".$image_URL."' alt='".$alt."' title='".get_the_title()."' height='".$option['wh']['height'] ." ' width='".$option['wh']['width'] ."' />".$linkwrap[1];

    I have read a lot in Internet but everything I can try (as I am not a programmer) does not seem to work.

    Thankl you for your support.



    This might seem obvious, but have you added Alt text to the image (in WP admin > Media > Library)?

    What’s the site URL?



    Hello James,

    The images have the Alt text. And the web page is http://www.alimmenta.com

    I can give you access to the server if needed.

    Thank you James.



    Can you post the content of /framework/helper_functions/kriesi_post_thumb.php to pastebin.com and link to it?

    The code Dude provided is correct so I don’t understand why it won’t work…



    Hello James and Dude,

    I paste the code here http://pastebin.com/ak55eaeH

    Thank you for your support.


    OK, I see.

    What I have tried now is to insert the Title of the image in the alt value. I can right the same information in the title of the image and in the alt value.

    I have been looking for a solution in internet but I can not find the right one. How can I obtain the title of the image?

    Thank you again.



    I am still looking for a solution. Is it possible to insert the title of the image in the alt value?


    Have a look at this article: http://somethinginteractive.com/blog/2009/07/23/get-images-captions-titles-for-images-attached-to-posts/ – you can use the code to output description, title, etc.


    I tried to do it myself but it is too complicated for me. I know that I should add the right code in the file kriesi_post_thumb.php in order to show the alt attribute of each image in the portfolio page or in the home page.

    Can anyone help me? I think it is a good (and needed for SEO reasons) improvement for the theme!



    I’ll report this to Kriesi – I’m sure he’s interested in implementing this feature in upcoming themes (and maybe he will release an update for Avisio, CleanCut, etc. too).

    For now l think that this modification is beyond the scope of this support forum.

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Get the ALT atribute of a image’ is closed to new replies.