2013-07-08 64 views
0

连接我使用此代码显示在我的类别thumbnails'posts:后缩略图WordPress的类别

<?php the_post_thumbnail('thumbnail', array('class' => 'alignleft')); ?> 

但我想将它们变成链接。 我试试这个代码:

<?php if (has_post_thumbnail()) : ?> 
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > 
<?php the_post_thumbnail(); ?> 
</a> 
<?php endif; ?> 

但文字不再出现在图片的右侧,并且图像过大。

如何解决它PLZ? (来源:http://codex.wordpress.org/Function_Reference/the_post_thumbnail

回答

1

试试这个:

<?php $imageClass = array ('class' => "alignleft",); ?> 
<?php if (has_post_thumbnail()) : ?> 
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" > 
<?php the_post_thumbnail('thumbnail', $imageClass); ?> 
</a> 
<?php endif; ?> 
+0

THX它的工作太棒了! – Theophile76