Here is an excerpt from my markup:
<img src="<?php echo get_post_meta($post->ID, 'thumbnail_value', true); ?>" title="<?php the_tags(); ?>" alt="" class="thumb"></a>
I've put in the "title" attribute <?php the_tags(); ?>
<?php the_tags(); ?>
which is a function from Wordpress. When I check the markup in Firebug I see this:
li class="view view_2 view-first">
<a id="50" href="" class="thumb_link" onclick="update_default_proj_list(1, '', '_'); getProject(50);"><span class="selected"></span><img
src="13370318682.jpg" title="Tags: <a href=" http:="" whiteandgold.ro="" realty="" ?tag="house"" rel="tag">house</a>, <a href="http://
whiteandgold.ro/realty/?tag=rent-3" rel="tag">rent</a>" alt="" class="thumb">
I've tried to hide that text with :
img.thumb[title] {text-indent:-9999px;}
a[rel~="tag"] { text-indent:-999px;}`
And it's not working, also you can see this here ( try to inspect a thumbnail)
the_tags() renders HTML, so you shouldn't put it inside the title attribute. Put it outside of any HTML attributes:
<div id="thepost">
// stuff
<?php the_tags(); ?>
</div>
If you still want to do this for some reason, you can make it work by using htmlspecialchars :
<img src="<?php echo get_post_meta($post->ID, 'thumbnail_value', true); ?>" title="<?php htmlspecialchars(the_tags()); ?>" alt="" class="thumb"></a>
Or maybe you just want a comma-separated list of tags, in which case you can generate it using get_the_tags() (which gives you an array of tags that you can do whatever you want with).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.