I want to create post layout in the following way:
+--------------------+ | 1 Full Width Post | +----------+---------+ | 2 | 3 | +--------------------+ | 4 Full Width Post | +----------+---------+ | 5 | 6 | +----------+---------+
So basically I want to use the post_class()
. Say for full width it will be "full-width" class and for half width it will be "half-width" class.
I was able to add even/odd class by this method:
function alternating_post_class( $classes ) {
global $wp_query;
$classes[] = ( $wp_query->current_post % 2 === 0 ? 'odd' : 'even' );
return $classes;
}
add_filter('post_class', 'alternating_post_class');
Any help would be greatly appreciated.