THanks man, but you have made it for 7 days. I think i’ve corrected it like that.
/**
* Registers the shortcode [wpp_views_count].
*
* @author Hector Cabrera (https://cabrerahector.com)
* @return string
*/
function wpp_views_count_func() {
if (
function_exists('wpp_get_views')
&& is_singular()
) {
$total_views_count = wpp_get_views(get_the_ID());
$total_views_count = (1 == $total_views_count) ? '1 преглед' : $total_views_count . ' прегледа';
$views_count_from_last_24_hours = wpp_get_views(get_the_ID(), 'last24hours');
$views_count_from_last_24_hours = (1 == $views_count_from_last_24_hours) ? '1 преглед' : $views_count_from_last_24_hours . ' прегледа';
return "<strong>Прегледа общо:</strong> {$total_views_count} | <strong>Прегледа днес:</strong> {$views_count_from_last_24_hours}";
}
return '';
}
add_shortcode('wpp_views_count', 'wpp_views_count_func');
If possible, can you tell me if we can make it to count per ip or something only for today, not per click.
And is there a way to put that code somewhere so i get it in all pages, so i won’t put it 1 by 1 on 1000 pages and of course a way to exclude it from certain pages.
Thanks. I think that should be good update, cuz its useful.
-
This reply was modified 5 years, 2 months ago by
qnkov.