2017-01-27 7 views
0

は、どのように私はWordpressのWordpressのサムネイルは、リンク

$output .= get_the_post_thumbnail(get_the_ID(),'Dave-profile', array('class' => 'img-responsive')); 

上のサムネイルにリンクを追加することができ、私は

<a href="'.get_the_permalink().'"></a> 

を追加しようとしました。しかし、それはあなたがすることによってこれを達成することができます

答えて

0
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); ?> 
<?php echo $image[0]; ?> 

上記のコードを使用してください。 サイズを変更する必要がある場合は、「シングルポストサムネイル」を置き換えます。

サムネイル、中、大、全角

0

動作しません。いろいろな方法があります:

if (has_post_thumbnail(get_the_ID())) 
{ 
    $output .= '<a href="' . get_permalink(get_the_ID()) . '">'; 
    $output .= get_the_post_thumbnail(get_the_ID(), 'Dave-profile', array('class' => 'img-responsive')); 
    $output .= '</a>'; 
} 

これが役立つことを願っています!

関連する問題