2016-12-28 35 views
0

divスタイルの背景(xxxxx)にタクソノミの画像URLを設定します。私は "taxonomy images"プラグインを使用しますが、wp_get_attachment_imageは機能しません。分類画像divの背景

<?php 
$terms = apply_filters('taxonomy-images-get-terms', '', array(
     'taxonomy'  => 'categoria_proyectos', 
    )); 

if (! empty($terms)) { 
    print ''; 
    foreach ((array) $terms as $term) { 
     print ' 
     <a href="' . esc_url(get_term_link($term, $term->taxonomy)) . '"> 
     <div class="style="background-image: url(xxxxxx); "> 
     </div> 
     </a>'; 
    } 
} 
?> 

答えて

0

添付のおすすめ画像のURLを取得するには、このコードを試してください。

<?php echo wp_get_attachment_image(get_the_ID(), array('700', '600'), "", array("class" => "img-responsive")); ?>