Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

MI on "WP Query - odd/even and post types"

$
0
0

Hi,

I want that odd and even posts would be different post types in one loop. How can i make it work? Here is the test query, which i think should work with getting odd and even ones, but how can i attach different post type here?

$args( 'post_type' => 'TYPE' );

$query = new WP_Query( $args );

<?php while (have_posts()): the_post() ?>
    <?php if ($wp_query->current_post % 2 == 0): ?>
        odd
    <?php else: ?>
        even
    <?php endif ?>
<?php endwhile ?>

Thanks


Viewing all articles
Browse latest Browse all 8245

Trending Articles