function cp_todays_count_widget($post_type, $limit) { $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'paged' => 1, 'no_found_rows' => true); $popular = new CP_Popular_Posts_Query($args, 'today'); echo '<ul class="pop">'; // must be views today if ($popular->have_posts()) { while ($popular->have_posts()) { $popular->the_post(); echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a> (' . appthemes_get_stats_by(get_the_ID(), 'today') . ' ' . __('views', APP_TD) . ')</li>'; } } else { echo '<li>' . __('No ads viewed yet.', APP_TD) . '</li>'; } echo '</ul>'; wp_reset_postdata(); }
$args = array('post_type' => 'post', 'posts_per_page' => 5, 'paged' => 1, 'no_found_rows' => true, 'date_start' => $lastmonths); $popular = new CP_Popular_Posts_Query($args); // give us the most popular blog posts based on page views, overall if (!$popular->have_posts()) { unset($args['date_start']); $popular = new CP_Popular_Posts_Query($args); } ?> <ul class="pop-blog"> <?php if ($popular->have_posts()) { while ($popular->have_posts()) { $popular->the_post(); ?> <li> <div class="post-thumb"> <?php if (has_post_thumbnail()) { echo get_the_post_thumbnail($post->ID, 'sidebar-thumbnail'); } ?> </div> <h3><a href="<?php echo get_permalink($post->ID); ?>