Пример #1
0
function appthemes_stats_counter($post_id)
{
    $today = appthemes_get_stats_by($post_id, 'today');
    $total = appthemes_get_stats_by($post_id, 'total');
    if ($total > 0) {
        echo $total . ' ' . __('total views', 'appthemes') . ', ' . $today . ' ' . __('today', 'appthemes');
    } else {
        echo __('No views yet', 'appthemes');
    }
}
Пример #2
0
/**
 * Prints total and daily page views for a post.
 *
 * @param int The post ID
 */
function appthemes_stats_counter($post_id)
{
    if (!current_theme_supports('app-stats')) {
        return false;
    }
    $today = appthemes_get_stats_by($post_id, 'today');
    $total = appthemes_get_stats_by($post_id, 'total');
    if ($total > 0) {
        printf(__('%d total views, %d today', APP_TD), $total, $today);
    } else {
        _e('No views yet', APP_TD);
    }
}
Пример #3
0
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') . '&nbsp;' . __('views', APP_TD) . ')</li>';
        }
    } else {
        echo '<li>' . __('No ads viewed yet.', APP_TD) . '</li>';
    }
    echo '</ul>';
    wp_reset_postdata();
}
			<span class="dashicons-before folder"><?php 
echo get_the_term_list(get_the_id(), APP_TAX_CAT, '', ', ', '');
?>
</span>
			<span class="dashicons-before clock"><span><?php 
echo appthemes_display_date($post->post_date, 'date');
?>
</span></span>
		</p>
	</td>

	<?php 
if (current_theme_supports('app-stats')) {
    ?>
		<td class="text-center"><?php 
    echo appthemes_get_stats_by($post->ID, 'total');
    ?>
</td>
	<?php 
}
?>

	<td class="text-center">
		<span class="status"><?php 
echo cp_get_status_i18n($status);
?>
</span>
		<?php 
if (in_array($status, array('live', 'live_expired', 'ended'))) {
    ?>
			<p class="small muted">(<?php