Hi people, first off all happy new year.
I want to create a percentage with daily_count and total_count, but i can’t do it, probably something is wrong. The code is below without the mess i create to put the percentage.
theme-support.php
add_theme_support( ‘app-stats’, array(
‘cache’ => ‘today’,
‘table_daily’ => ‘counter_daily’,
‘table_total’ => ‘counter_total’,
‘meta_daily’ => ‘daily_count’,
‘meta_total’ => ‘total_count’,
author-dashboard.php
<?php if (get_post_meta($my_query->post->ID, ‘jr_total_count’, true)) $job_views = number_format(get_post_meta($my_query->post->ID, ‘jr_total_count’, true)); else $job_views = ‘-’; ?>
theme-functions.php
// get the page view counters and display on the page
function appthemes_get_stats($post_id) {
global $posts, $app_abbr;
$daily_views = get_post_meta($post_id, $app_abbr.'_daily_count', true);
$total_views = get_post_meta($post_id, $app_abbr.'_total_count', true);
if(!empty($total_views) && (!empty($daily_views)))
echo number_format($total_views) . ' ' . __('total views', APDB). ', ' . number_format($daily_views) . ' ' . __('today', APDB);
else
echo __('no views yet', APDB);
}
Can someone help?