Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter danielk21

    (@danielk21)

    I solved my own question. I added a $count variable before the loop and it icreases by 1.

    here is the code:

    <?php rewind_posts();
                            $count = 0;
                            $my_query = new WP_Query( array( 'category_name' => 'il belpaese', 'posts_per_page' => 2, 'post__not_in' => $do_not_duplicate ) );
                            ?>
                        <section class="category-box clear">
                            <div class="bg-wrapper clear">
                            <?php
                            while ( $my_query->have_posts() ) : $my_query->the_post();
                            $count++;
                            $do_not_duplicate[] = $post->ID; ?>
    
                            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                                <section class="sub-cat-post medium-left clear">
    
                                        <?php if ( $count == 1 ) { ?>
                                            <figure class="featured-image medium-img">
                                                <a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
                                                        <?php the_post_thumbnail( 'discover-magazine-category-medium' ); ?>
                                                </a>
                                            </figure>....
Viewing 1 replies (of 1 total)