WordPress的。如何获得没有默认类的缩略图?

时间:2014-12-24 09:27:00

标签: wordpress class post thumbnails

我有缩略图代码

$img = get_the_post_thumbnail (
    get_the_ID(), array(100, 100),
    array (
        'alt' => get_the_title(),
        'title' => get_the_title()
    )
);

结果:

<img width="100" height="100" src="http://formation.com/wp-content/uploads/2013/03/featured-image-vertical-150x150.jpg" rel="magnific" class="attachment-100x100 wp-post-image" alt="Template: Featured Image (Vertical)" title="Template: Featured Image (Vertical)">

如何在没有&#34; wp-post-image&#34;的情况下获得相同的图像类?

1 个答案:

答案 0 :(得分:0)

$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );


<img src="<?php echo $url; ?>" longdesc="URL_2" alt="Text_2" />

您可以使用函数get_post_thumbnail_id()来获取相同的图像