How to remove the prominent post from the right column?

1

Good morning everyone, I have a site that I'm messing around where at home has a posts slide, where big appears the featured post and next to right 3 small posts. My problem is that in the column of 3 posts, also appears the featured post, that is, in addition to it large in the left column, it appears small in the right column. How can I make sure he does not show this same post? Actually, the featured post is the last post inserted by my client.

Follow the code:

<div class="featured-posts-wrap">
            <div class="row">
                <div class="col-9 nopadding">
                    <div class="blog-title">
                        <h2>notícias/</h2>
                    </div>
                    <div id="latest-posts">
                        <div class="tab-container">
                        <?php
                            $displayposts = new WP_Query();
                            $displayposts->query('posts_per_page=3');
                            while ($displayposts->have_posts()) : $displayposts->the_post();
                            $tab_number = $displayposts->current_post + 1;            
                        ?>
                        <div id="tab<?php echo $tab_number;?>"class="tab_content">
                            <div class="post clearfix">
                                <?php if ( has_post_thumbnail() ) { ?>
                                <div class="post-image">
                                    <?php the_post_thumbnail(); ?>
                                </div>
                                <?php } ?>
                                <div class="meta-wrap">
                                    <div class="author-wrap"><p><?php the_category(', '); ?></p></div>
                                </div>

                                <div class="post-content">
                                    <div class="post-title">
                                        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                                    </div>
                                    <div class="read-wrap"><a href="<?php the_permalink(); ?>">Leia mais</a></div>
                                </div>
                            </div>
                        </div>
                        <?php endwhile; ?>
                        </div>
                        <ul class="nav tabs">
                            <?php
                                while ($displayposts->have_posts()) : $displayposts->the_post();
                                $tab_number = $displayposts->current_post + 1;
                            ?>
                            <li>
                                <div class="meta-wrap">
                                    <div class="author-wrap"><p><?php the_category(', '); ?></p></div>
                                </div>
                                <h2><a href="javascript:void(0);" id="link<?php echo $tab_number;?>"><?php the_title(); ?></a></h2>
                                <div class="read-wrap"><a href="<?php the_permalink(); ?>">Leia mais</a></div>
                            </li>
                            <?php endwhile; ?>
                        </ul>
                    </div>

                </div>

Follow the image of this block to your understanding:

Thanks in advance for your attention!

    
asked by anonymous 30.12.2016 / 15:35

1 answer

0

Test the following code, it is the simplest and most effective way to use multiple loops within WP:

<div id="latest-posts">
    <div class="tab-container">
                    <?php
                        $featuredPostArgs = array(
                            'posts_per_page' => 1
                        );
                        $featuredPost = new WP_Query($featuredPostArgs);
                        while ($featuredPost->have_posts()) : $featuredPost->the_post();
                        $tab_number = $featuredPost->current_post + 1;            
                    ?>
                    <div id="tab<?php echo $tab_number;?>" class="tab_content">
                        <div class="post clearfix">
                            <?php if ( has_post_thumbnail() ) { ?>
                            <div class="post-image">
                                <?php the_post_thumbnail(); ?>
                            </div>
                            <?php } ?>
                            <div class="meta-wrap">
                                <div class="author-wrap"><p><?php the_category(', '); ?></p></div>
                            </div>

                            <div class="post-content">
                                <div class="post-title">
                                    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                                </div>
                                <div class="read-wrap"><a href="<?php the_permalink(); ?>">Leia mais</a></div>
                            </div>
                        </div>
                    </div>
                    <?php endwhile; wp_reset_postdata(); ?> 
                </div>
                <ul class="nav tabs">
                    <?php
                        $featuredPostsArgs = array(
                            'posts_per_page' => 3,
                            'offset' => -1
                        );
                        $featuredPosts = new WP_Query($featuredPostsArgs);
                        while ($featuredPosts->have_posts()) : $featuredPosts->the_post();
                        $tab_number = $featuredPosts->current_post + 1;            
                    ?>
                    <li>
                        <div class="meta-wrap">
                            <div class="author-wrap"><p><?php the_category(', '); ?></p></div>
                        </div>
                        <h2><a href="javascript:void(0);" id="link<?php echo $tab_number;?>"><?php the_title(); ?></a></h2>
                        <div class="read-wrap"><a href="<?php the_permalink(); ?>">Leia mais</a></div>
                    </li>
                    <?php endwhile; wp_reset_postdata(); ?> 
                </ul>
            </div>

I tested it on my side and it's working, check if it works there too:)

    
02.01.2017 / 17:23