September 15, 2010 at 10:08 pm #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.September 15, 2010 at 11:23 pm #34316
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."<img src='".$image_URL."' alt='".get_the_title()."' title='".get_the_title()."' />".$linkwrap;
How I can get the alt atribute of an image? Is there a function for this?September 16, 2010 at 5:39 am #34317September 16, 2010 at 3:35 pm #34318
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."<img ".$img_attr_string." src='".$image_URL."' alt='".$alt."' title='".get_the_title()."' height='".$option['wh']['height'] ." ' width='".$option['wh']['width'] ."' />".$linkwrap;
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.September 16, 2010 at 3:58 pm #34319
This might seem obvious, but have you added Alt text to the image (in WP admin > Media > Library)?
What’s the site URL?
JamesSeptember 16, 2010 at 7:25 pm #34320
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.September 17, 2010 at 3:09 pm #34321
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…
JamesSeptember 17, 2010 at 10:43 pm #34322
Hello James and Dude,
I paste the code here http://pastebin.com/ak55eaeH
Thank you for your support.September 21, 2010 at 5:58 pm #34323
The code is correct, having dug little deeper I think this might be a WordPress bug rather than a problem with the code.
JamesSeptember 23, 2010 at 10:53 am #34324
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.October 15, 2010 at 7:24 am #34325
I am still looking for a solution. Is it possible to insert the title of the image in the alt value?October 16, 2010 at 6:34 am #34326December 9, 2010 at 12:24 pm #34327
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!December 10, 2010 at 9:31 am #34328
The topic ‘Get the ALT atribute of a image’ is closed to new replies.