Fotosons
Member
Posted 1 year ago #
Hi,
I'm using the_excerpt to fill the alt tags of my images in wordpress. But when I look the code the result is something like that:
title="Image title" alt="<p>Image tag</p>"/></a>
Anybody knows why the alt section shows between paragraphs? The code of the theme is:
<a href="<?php the_permalink() ?>"><img src="<?php echo $thumbnail_value; ?>" title="<?php the_title(); ?>" alt="<?php the_excerpt(); ?>"/></a>
Help me with that please, thanks!
the_excerpt automatically adds opening and closing paragraph tags around the text contained within it. That particular function isn't meant for ALT tags, it's meant to generate a paragraph of text summarizing a post, hence the <p> tags.
http://codex.wordpress.org/Function_Reference/the_excerpt
http://codex.wordpress.org/Function_Reference/get_the_excerpt
<a href="<?php the_permalink() ?>"><img src="<?php echo $thumbnail_value; ?>" title="<?php the_title(); ?>" alt="<?php echo get_the_excerpt(); ?>"/></a>
Fotosons
Member
Posted 1 year ago #
Hi Alchymyth!
Resolved!!! Thanks a lot!!!