先頭の記事だけスタイルを変更したいとかの場合に。
ソース
ループ内の先頭記事ボックスの任意の場所に、以下を記述。
<?php
if(isFirst()){
post_class('first_art');
}else{
post_class();
}
?>
そうすると、
<article class="xxx yyy zzz first_art">hogehoge</article>
という具合に。
function.phpに以下を書くのを忘れないように。
function isFirst(){
global $wp_query;
return ($wp_query->current_post === 0);
}
注意事項
elseのくだりを書いておかないと、先頭記事じゃない記事に一切classがつかなくなります。