1
我怎麼能得到一個post_class「第一」頁上的每一個職位?頁面上的每個第一篇文章的第一課wordpress
使用此代碼爲循環的第一個帖子管理了一個類「first_post」,但我也需要它在循環的第二頁,第三頁等。
function.php
function firstpost_class($class) {
global $post, $posts;
if (is_home() && !is_paged() && ($post == $posts[0])) $class[] = 'firstpost';
return $class;
}
add_filter('post_class', 'firstpost_class');
感謝您的幫助。谷歌無法幫助。