functions.php
isFirst(1件目)
function isFirst(){
global $wp_query;
return ($wp_query->current_post === 0);
}
isSecond(2件目)
function isSecond(){
global $wp_query;
return ($wp_query->current_post === 1);
}
isLast(最終件目)
function isLast(){
global $wp_query;
return ($wp_query->current_post+1 === $wp_query->post_count);
}
isOdd(奇数件目)
function isOdd(){
global $wp_query;
return ((($wp_query->current_post+1) % 2) === 1);
}
isEvery(偶数件目)
function isEvery(){
global $wp_query;
return ((($wp_query->current_post+1) % 2) === 0);
}
コメント