您可以向每个帖子添加自定义类。以下是一种方法的快速示例:
add_action(\'post_class\',\'YOURNAME_post_class\');
function YOURNAME_post_class( $classes ) {
global $wp_query;
if( ! $wp_query->is_main_query() )
return $classes;
$classes[] = \'class-on-all-posts\';
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 )
$classes[] = \'class-on-every-third-post\';
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 )
$classes[] = \'class-on-every-second-post\';
return $classes;
}
然后,您可以根据post类调整图像和div对齐css。