Display popularpost posts of the last 2 days

I have sidebar.php and it show 10 popularpost of my wordpress post. But i want just Display popularpost of the last 2 days. How i can correct it?

Thanks

                    </div>
                <?php } if (of_get_option('most_radio')==1) { ?>
                 <div class="rmenu col-lg-12 col-sm-12 col-xs-12">
                    <header class="title-panel">
                        <div class="title-arrow"></div>
                        <h2 class="title-text"><?php echo of_get_option('most_title'); ?></h2>

                    </header>
                    <footer class="most-viewed">
                        <div class="most-viewed-content mCustomScrollbar" data-mcs-theme="dark-thin">

                            <?php if(of_get_option('most_radio_select')==1){
                                    $popularpost = new WP_Query( array(
                                    'post_status' =>'publish',
                                    'post_type' =>'post',
                                    'posts_per_page' => of_get_option('most_count'),
                                    'orderby' => 'meta_value_num',
                                    'meta_key' => 'post_views_count',
                                    'order' => 'DESC'
                                    )
                                ); ?>
                                <ol>
                            <?php
                                if($popularpost->have_posts()) : while($popularpost->have_posts()) : $popularpost->the_post();
                            ?>

                                    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php echo getPostViews(get_the_ID()); ?> </li>

                            <?php endwhile; endif; ?></ol> <? }else{?>

                            <ol>
                            <?php
                                $big_query = new WP_Query(array(
                                'post_status' =>'publish',
                                'post_type' =>'post',
                                'cat' => of_get_option('most_select_categories'),
                                'posts_per_page' => of_get_option('most_count'))); ?>
                                <?php if($big_query->have_posts()) : while($big_query->have_posts()) : $big_query->the_post();?>

                                <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
                                <?php endwhile; ?>
                    <?php endif; ?>

                            </ol>
                            <?php } ?>

Read more here: Display popularpost posts of the last 2 days

Leave a Reply

Your email address will not be published. Required fields are marked *