Loops と Wordpress の機能に取り組んだ後、これが と を使用して「注目の」画像を自動的に表示する唯一の方法でしalt == excerpt
たtitle == title
。
これが最も効率的な方法ですか?
<?php
query_posts(array('category_name' => 'Featured'));
if (have_posts()) : while(have_posts()) : the_post();
$alt = get_the_excerpt();
$title = get_the_title();
the_post_thumbnail( 'full', array('alt' => $alt, 'title' => $title, 'class' => 'bigImg') );
endwhile; endif;
?>
私を最も悩ませているのは、ループで抜粋とタイトルを定義しているという事実です。そのため、ループでもハッシュ配列を表示する必要があります。それについては、私とうまく合わないことがあります。